无法导入咖啡
Unable to import caffe
我在caffe目录下执行了make pycaffe
,运行正常。我也是这样做的:
gsamaras@gsamaras-A15:~/caffe/python$ export PYTHONPATH=$PYTHONPATH:/home/gsamaras/caffe/python
但是当我尝试在另一个项目中导入 caffe 时,我得到了这个:
ImportError: No module named caffe
如何解决这个问题?
还要注意在caffe的Makefile.config中,有这样一行:
PYTHON_INCLUDE := /usr/include/python2.7 \ <-- correct
/usr/lib/python2.7/dist-packages/numpy/core/include <-- doesn't exist
我的numpy版本是1.11。
相关:
编辑:
我找到 this,这表明 pip install -U scikit-image
,但它失败了:
Running setup.py (path:/tmp/pip_build_root/scikit-image/setup.py) egg_info for package scikit-image
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Utility'
...
Downloading/unpacking decorator>=3.4.0 (from networkx>=1.8->scikit-image)
Downloading decorator-4.0.9-py2.py3-none-any.whl
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1091, in prepare_files
req_to_install.check_if_exists()
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 811, in check_if_exists
self.satisfied_by = pkg_resources.get_distribution(self.req)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 535, in get_distribution
dist = get_provider(dist)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 415, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
IndexError: list index out of range
现在我收到这个错误:
ImportError: No module named skimage.io
毕竟我不得不使用 sudo apt-get install -U scikit-image
!原因是:Didn't work with pip, but worked with apt-get?
sudo apt-get install python-skimage
对我有用。
当我尝试导入 skimage.io 时,我在安装 caffe 时遇到了类似的错误。但是,当我尝试通过 pip 安装 skimage 时,它失败并显示与上面相同的消息。
然后我尝试使用apt-get来安装scikit-image。它成功地完成了。不幸的是,它安装了过时的版本,导致我的代码出现另一个错误。
最后,我找到了解决方法,首先安装 virtualenv 并使用 pip 重新安装这些库(scikit-image、scipy、matplotlib 等)。我的咖啡现在可以完美运行了。希望这对处于相同情况的其他人有所帮助。
我在caffe目录下执行了make pycaffe
,运行正常。我也是这样做的:
gsamaras@gsamaras-A15:~/caffe/python$ export PYTHONPATH=$PYTHONPATH:/home/gsamaras/caffe/python
但是当我尝试在另一个项目中导入 caffe 时,我得到了这个:
ImportError: No module named caffe
如何解决这个问题?
还要注意在caffe的Makefile.config中,有这样一行:
PYTHON_INCLUDE := /usr/include/python2.7 \ <-- correct
/usr/lib/python2.7/dist-packages/numpy/core/include <-- doesn't exist
我的numpy版本是1.11。
相关:
编辑:
我找到 this,这表明 pip install -U scikit-image
,但它失败了:
Running setup.py (path:/tmp/pip_build_root/scikit-image/setup.py) egg_info for package scikit-image
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Utility'
...
Downloading/unpacking decorator>=3.4.0 (from networkx>=1.8->scikit-image)
Downloading decorator-4.0.9-py2.py3-none-any.whl
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1091, in prepare_files
req_to_install.check_if_exists()
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 811, in check_if_exists
self.satisfied_by = pkg_resources.get_distribution(self.req)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 535, in get_distribution
dist = get_provider(dist)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 415, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
IndexError: list index out of range
现在我收到这个错误:
ImportError: No module named skimage.io
毕竟我不得不使用 sudo apt-get install -U scikit-image
!原因是:Didn't work with pip, but worked with apt-get?
sudo apt-get install python-skimage
对我有用。
当我尝试导入 skimage.io 时,我在安装 caffe 时遇到了类似的错误。但是,当我尝试通过 pip 安装 skimage 时,它失败并显示与上面相同的消息。
然后我尝试使用apt-get来安装scikit-image。它成功地完成了。不幸的是,它安装了过时的版本,导致我的代码出现另一个错误。
最后,我找到了解决方法,首先安装 virtualenv 并使用 pip 重新安装这些库(scikit-image、scipy、matplotlib 等)。我的咖啡现在可以完美运行了。希望这对处于相同情况的其他人有所帮助。