python下导入caffe_python命令行中import caffe报错的解决方案

1、ImportError:

No module named skimage.io

>>> import caffe

Traceback (most recent call last):

File "", line 1, in

File "caffe/__init__.py", line 1, in

from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer

File "caffe/pycaffe.py", line 15, in

import caffe.io

File "caffe/io.py", line 2, in

import skimage.io

ImportError: No module named skimage.io

解决方案:

缺乏skimage工具箱

pip install scikit-image

2、ImportError: dynamic module does not define module export function (PyInit__caffe)

>>> import caffe

Traceback (most recent call last):

File "", line 1, in

File "/home/wangxiao/Downloads/project/caffe-master/python/caffe/__init__.py", line 1, in

from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver

File "/home/wangxiao/Downloads/project/caffe-master/python/caffe/pycaffe.py", line 13, in

from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \

ImportError: dynamic module does not define module export function (PyInit__caffe)

>>>

发现是 Python  3.5 导致的,因为版本较高的 Python 和 caffe 不一定兼容;

caffe 官网 (http://caffe.berkeleyvision.org/) 上也提示说,

只是较好的支持 caffe 2.7 版本;对于其他的版本,需要自己进行摸索咯。

3、ImportError: No module named google.protobuf.internal

解决方案:

sudo pip install protobuf

4、ImportError: No module named caffe

解决方案:把caffe目录下的python目录,添加到环境变量中

export PYTHONPATH=/work/project/caffe/python:$PYTHONPATH

参考:https://www.cnblogs.com/wangxiaocvpr/p/6285542.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值