Pycharm导入numpy等报错

导入numpy,pycharm报错如下:

import numpy
Traceback (most recent call last):
File “D:\Program Files\Python36\lib\site-packages\numpy\core_init_.py”, line 16, in
from . import multiarray
ImportError: DLL load failed: 找不到指定的程序。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “”, line 1, in
import numpy
File “D:\Program Files\Python36\lib\site-packages\numpy_init_.py”, line 142, in
from . import add_newdocs
File “D:\Program Files\Python36\lib\site-packages\numpy\add_newdocs.py”, line 13, in
from numpy.lib import add_newdoc
File “D:\Program Files\Python36\lib\site-packages\numpy\lib_init_.py”, line 8, in
from .type_check import *
File “D:\Program Files\Python36\lib\site-packages\numpy\lib\type_check.py”, line 11, in
import numpy.core.numeric as nx
File "D:\Program Files\Python36\lib\site-packages\numpy\core_init
.py", line 26, in
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you’re working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.

最后发现,之前自己用的是python2.7,更换为python3.7后,忘记更改系统变量。
将系统变量更成之后,将C:\Users\user\Anaconda3\Library\bin添加到系统变量,重启pycharm,运行成功。

你可能感兴趣的:(Python)