我安装了anaconda3(64位)并设置了两个conda环境:py27和py36。 当我在python2.7中导入numpy时,我遇到了这个问题:
DLL加载失败:%1不是有效的Win32应用程序
错误追溯:
runfile('E:/master/project/try1.py', wdir='E:/master/project')
Traceback (most recent call last):
File "<ipython-input-2-5f6896d42b49>", line 1, in <module>
runfile('E:/master/project/try1.py', wdir='E:/master/project')
File "C:\Users\wangyl\Anaconda3\envs\py27\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
execfile(filename, namespace)
File "C:\Users\wangyl\Anaconda3\envs\py27\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "E:/master/project/try1.py", line 1, in <module>
import numpy as np
File "C:\Users\wangyl\AppData\Roaming\Python\Python27\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Users\wangyl\AppData\Roaming\Python\Python27\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\wangyl\AppData\Roaming\Python\Python27\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\wangyl\AppData\Roaming\Python\Python27\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\wangyl\AppData\Roaming\Python\Python27\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
错误讯息:
ImportError:导入多阵列numpy扩展模块失败。您很可能正在尝试导入失败的numpy版本。 如果您正在使用numpy git repo,请尝试
git clean -xdf
(删除 所有不受版本控制的文件)。否则重新安装numpy。原始错误是:
DLL加载失败:%1不是有效的Win32应用程序
如何解决这个问题?