Numpy已安装但无法导入多数组

时间:2018-11-26 05:38:43

标签: python numpy cv2 numpy-ndarray

我正在尝试使openface工作。

这是进行设置的说明。

>conda config --add channels conda-forge
>conda install opencv numpy pandas scipy scikit-learn scikit-image dlib txaio twisted autobahn OpenSSL pyopenssl imagehash service_identity

我删除了numpy并重新安装以确保已安装numpy。

Downloading and Extracting Packages
openblas-0.3.3       | 13.7 MB   | ##################################### | 100% 
numpy-1.15.4         | 8.9 MB    | ##################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

因此已安装numpy。 但是我尝试导入numpy并出现错误

(openface) nyan@nyan-Inspiron-7537:~$ python
Python 2.7.14 |Anaconda, Inc.| (default, Dec  7 2017, 17:05:42) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 180, in <module>
    from . import add_newdocs
  File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib/python2.7/dist-packages/numpy/core/__init__.py", line 14, in <module>
    from . import multiarray
ImportError: cannot import name multiarray
>>> 

怎么了?

1 个答案:

答案 0 :(得分:0)

似乎是正确的python可执行文件,因为它会在版本字符串中打印Anaconda。但是错误消息中的numpy路径是“ / usr / lib / ...”,这可能不是您的Anaconda路径。

如果可能的话,应该删除损坏的系统numpy,并确保正确使用conda环境,请参见Managing environments