vscode导入numpy报错:DLL load failed: The specific module could not be found

报错描述

  1. anaconda prompt中,import numpy正常
  2. vscode中,import numpy报错:DLL load failed

报错原因

vscode未能正确初始化环境变量

解决方法

打开vscodesettings.json文件

(type)               CTRL + SHIFT + P
(search for:)        open settings
(click:)             Preferences: Open Settings (JSON)

添加三行

{
    ... # any other settings you have already added (remove this line)

    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "terminal.integrated.shellArgs.windows": ["/K", "x:\\xxx\\Anaconda3\\Scripts\\activate.bat x:\\xxx\\Anaconda3"],
    "python.condaPath": "x:\\xxx\\Anaconda3\\Scripts\\conda.exe"
}
发布了103 篇原创文章 · 获赞 162 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/zhaoyin214/article/details/105274503
今日推荐