导入caffe错误ImportError:numpy.core.multiarray导入失败

时间:2018-07-17 13:10:31

标签: windows caffe pycaffe

我按照BVLC\caffe针对Windows Caffe的说明,通过scripts\build_win.cmdCPU_ONLY=1BUILD_PYTHON=1BUILD_PYTHON_LAYER=1)成功构建了caffe。

然后,将C:\Projects\caffe\python\caffe文件夹复制到我的site_packages文件夹[...]\Anaconda3\Lib\site-packages中。 我正在使用Anaconda 4.2.0,并且根据需要将Python 3.5用于caffe。

但是现在它无法导入caffe,我也不明白为什么,因为我看到的所有情况都是关于没有为python编译的(我假设是由BUILD_PYTHON=1标志完成的)将python\caffe文件夹复制到site-packages文件夹中。

这是错误输出:

>>> import caffe
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Projects\anaconda\Anaconda3\lib\site-packages\caffe\__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
  File "C:\Projects\anaconda\Anaconda3\lib\site-packages\caffe\pycaffe.py", line  13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
SystemError: initialization of _caffe raised unreported exception

即使我尝试将C:\Projects\caffe\python文件夹添加到python路径中,从我所看到的来看这也不是一个好主意,但它仍然会失败,出现同样的错误:

>>> import sys
>>> sys.path.insert(0, "C:\Projects\caffe\python")
>>> import caffe
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Projects\caffe\python\caffe\__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
  File "C:\Projects\caffe\python\caffe\pycaffe.py", line 13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
SystemError: initialization of _caffe raised unreported exception

也许我错过了一些事情,希望有人能看到并能提供帮助。 谢谢。

0 个答案:

没有答案