【发布时间】:2019-11-05 21:53:15
【问题描述】:
我是机器学习的新手,我正在尝试习惯 VS Code,所以我尝试使用它,但很快遇到了一些问题(不知道如何在终端上运行 python,使用 conda 环境等) .主要问题是我使用 anaconda 的软件包在 VS Code 中不起作用。
我已经尝试了所有方法,但无法让它在终端中运行。我会用这个例子来解释自己。
示例代码:
#Not my actual code, but it's an example
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
x = np.linspace(0, 20, 100)
plt.plot(x,np.sin(x))
plt.show()
当我运行它时, this shows up in the terminal
Traceback (most recent call last):
File "c:/Users/arman/Desktop/Untitled-1.py", line 2, in <module>
import numpy as np
File "C:\Users\arman\Anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\arman\Anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: No se puede encontrar el módulo especificado.
###NOTE: this part 'DLL load failed: No se puede encontrar el módulo especificado.' basically means that it didnt find the module, sorry for the spanish.
,即使我在 conda 环境中。 conda 附带的每个软件包都会发生这种情况。
我该怎么做才能让它发挥作用?为什么会这样?
【问题讨论】:
-
几件事:1)确保安装了Python扩展link; 2) 按
Ctrl+Shift+P并输入Python: Select Interpreter。单击该按钮将列出您拥有的所有可用 Python 安装,包括 conda 安装。
标签: python visual-studio-code anaconda package