Visual Studio Code,Conda和Python环境(我无法正常运行)

问题描述 投票:1回答:1

我正在我的电脑上设置Visual Studio Code,并且在创建的python环境和Visual Studio Code方面遇到了困难。

但是,当运行一些测试代码时,出现导入错误。。

我将带有miniconda的Python 3.7.3安装到'C:\ Python37',然后创建了名为'sci'的基本环境的克隆,并使用cmd安装了一些软件包(numpy,pandas,matplotlib,scipy,scikit-learn) 。我使用以下命令在cmd中测试了安装:

conda activate sci 
python
import numpy
print(numpy.array([1, 2, 3]))

并且一切正常。

然后我将Visual Studio Code(.zip,未使用安装程序安装)安装到'C:\ VisualStudioCode',打开一个文件夹进行测试,并使用'Python:Select Interpreter'命令指定我在上面创建的sci环境。现在,当我运行以下代码时,我将收到导入错误消息:

import numpy
numpy.array([1, 2, 3])

ImportError: DLL load failed: The specified module could not be found.

知道为什么会这样吗?我的“ VS代码”窗口的左下角显示的是Python 3.7.3 64位('sci':conda),但是在VS Code终端中键入conda env list时,它仍指向基本环境,因此可能是一个线索。 。

谢谢您的任何建议!

我正在我的电脑上设置Visual Studio Code,并且在创建的python环境和Visual Studio Code方面遇到了困难。但是,当运行一些测试代码时,出现导入错误.....

python-3.x visual-studio-code conda environment
1个回答
0
投票

在尝试采用其他解决方案感到无奈之后,这终于对我(在Windows 10机器上)安装了Anaconda python的工作了。

© www.soinside.com 2019 - 2024. All rights reserved.