"import numpy as np" ImportError: No module named numpy

问题:没有安装numpy

解决方法:

下载文件,安装

numpy-1.8.2-win32-superpack-python2.7

安装运行import numpy,出现

Traceback (most recent call last):
  File "", line 1, in 
    import numpy
  File "C:\Python27\lib\site-packages\numpy\__init__.py", line 153, in 
    from . import add_newdocs
  File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in 
    from numpy.lib import add_newdoc
  File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 8, in 
    from .type_check import *
  File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 11, in 
    import numpy.core.numeric as _nx
  File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 6, in 
    from . import multiarray
ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

原因是:python 装的是64位的,numpy装的是32位的

重新安装numpy为:numpy-1.8.0-win64-py2.7

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

转载于:https://my.oschina.net/u/1463748/blog/842970

你可能感兴趣的:("import numpy as np" ImportError: No module named numpy)