当我使用Anaconda时,导入numpy会给我以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File"C:\Users\s140041\Anaconda3\envs\testenv\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File"C:\Users\s140041\Anaconda3\envs\testenv\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\s140041\Anaconda3\envs\testenv\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File"C:\Users\s140041\Anaconda3\envs\testenv\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File"C:\Users\s140041\Anaconda3\envs\testenv\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
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.
Original error was: DLL load failed: The specified module could not be found.
我已经完成了很多故障排除:
只有当我使用conda卸载并使用pip重新安装时,一切正常...我在这里做错了什么,或者在这个Anaconda的安装中是否已经破坏了?
我刚从普通的python / venv / pip切换到Anaconda / conda / environment,但我必须说这不是一个热烈的欢迎......尽管我听说conda打包系统比pip / venv更好。
更新:我在github上提交了一个bug报告,可以在这里找到。 https://github.com/conda/conda/issues/7833
关于出了什么问题的非常明确的讨论可以在GitHub的bug报告中找到:
https://github.com/conda/conda/issues/7833
总结一下,使用PyCharm与未激活的环境是不受支持的。所以要么使用anaconda提示,激活你的环境并从那里启动PyCharm,要么重新安装anaconda / mini-conda并选中“add-to-path”选项