我正在尝试让caffe在配备 Ubuntu 12.04LTS 的机器上运行。完成安装页面上的所有步骤后,我成功地训练了 LeNet 模型并尝试将其用作此处的教程。然后我收到以下错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named caffe
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 18, in <module>
import problem_report
File "/usr/lib/python2.7/dist-packages/problem_report.py", line 14, in <module>
import zlib, base64, time, sys, gzip, struct, os
File "/usr/lib/python2.7/gzip.py", line 10, in <module>
import io
File "${HOME}/path/to/caffe/python/caffe/io.py", line 2, in <module>
import skimage.io
File "/usr/local/lib/python2.7/dist-packages/skimage/io/__init__.py", line 11, in <module>
from ._io import *
File "/usr/local/lib/python2.7/dist-packages/skimage/io/_io.py", line 1, in <module>
from io import BytesIO
ImportError: cannot import name BytesIO
Original exception was:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named caffe
在执行上述操作之前,我设置了PYTHONPATH
in文件。.bashrc
问题是什么?谁能给点提示?我真的很困惑。python -c 'import io; print io.__file__'
在非常目录中运行命令后:
Traceback (most recent call last):
File "${HOME}/path/to/caffe/python/caffe/io.py", line 2, in <module>
import skimage.io
File "/usr/local/lib/python2.7/dist-packages/skimage/io/__init__.py", line 11, in <module>
from ._io import *
File "/usr/local/lib/python2.7/dist-packages/skimage/io/_io.py", line 1, in <module>
from io import BytesIO
ImportError: cannot import name BytesIO
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 18, in <module>
import problem_report
File "/usr/lib/python2.7/dist-packages/problem_report.py", line 14, in <module>
import zlib, base64, time, sys, gzip, struct, os
File "/usr/lib/python2.7/gzip.py", line 10, in <module>
import io
File "${HOME}/path/to/caffe/python/caffe/io.py", line 2, in <module>
import skimage.io
File "/usr/local/lib/python2.7/dist-packages/skimage/io/__init__.py", line 11, in <module>
from ._io import *
File "/usr/local/lib/python2.7/dist-packages/skimage/io/_io.py", line 1, in <module>
from io import BytesIO
ImportError: cannot import name BytesIO
Original exception was:
Traceback (most recent call last):
File "${HOME}/path/to/caffe/python/caffe/io.py", line 2, in <module>
import skimage.io
File "/usr/local/lib/python2.7/dist-packages/skimage/io/__init__.py", line 11, in <module>
from ._io import *
File "/usr/local/lib/python2.7/dist-packages/skimage/io/_io.py", line 1, in <module>
from io import BytesIO
ImportError: cannot import name BytesIO
那么,问题就变成了:如何解决名称问题?PS:我还在caffe 的存储库中插入了一个问题。