我在Windows 10计算机上安装了Anaconda 3.7 64位。它安装成功,我可以打开Jupyter并在Jupyter中运行Python代码,而不会出现问题,包括导入软件包。
但是,如果我尝试从Visual Studio Code或Visual Studio Professional 2017导入包,则会收到如下错误:
C:/Users/brubin/AppData/Local/Continuum/anaconda3/python.exe
c:/Users/brubin/Desktop/test.py Traceback (most recent call last):
File "c:/Users/brubin/Desktop/test.py", line 1, in <module>
import matplotlib.pyplot
File "C:\Users\brubin\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\pyplot.py", line 32, in <module>
import matplotlib.colorbar
File "C:\Users\brubin\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\colorbar.py", line 32, in <module>
import matplotlib.contour as contour
File "C:\Users\brubin\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\contour.py", line 18, in <module>
import matplotlib.font_manager as font_manager
File "C:\Users\brubin\AppData\Local\Continuum\anaconda3\lib\site-packages\matplotlib\font_manager.py", line 48, in <module>
from matplotlib import afm, cbook, ft2font, rcParams, get_cachedir
ImportError: DLL load failed: The specified module could not be found.
我发现了几则有关同一问题的文章,他们通常建议先做pip uninstall matplotllib
,然后再做pip install matplotlib
。我这样做了,现在我的程序可以正确运行了(我也必须对numpy
做同样的事情)。
我的问题是:
c:/users/brubin/AppData/Local/Continuum/anaconda3
,这是Anaconda安装在此处而不是像users/brubin
或Program Files
这样的地方的事实吗?