vscode & Anaconda import numpy failed: DLL load failed
Phenomenon:
in Anaconda prompt, import numpy is normal
in vscode, import numpy reports an error: DLL load failed
Error reason:
shell opening failed, resulting in CONDA activate failure. There is no environment, and naturally there is no numpy
Solution:
open the vscodesettings.json file
(type) CTRL + SHIFT + P
(search for:) open settings
(click:) Preferences: Open Settings (JSON)
Add in settings.json:
"terminal.integrated.profiles.windows":{
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
},
"terminal.integrated.defaultProfile.windows":"Command Prompt"
In addition, I also refer to another blog. You need to configure the environment variable
and put the following contents into this computer -> Attribute -> Advanced system settings -> Environment variable -> Path path:
D:\anaconda
D:\anaconda\Scripts
D:\anaconda\Library\bin
D:\anaconda\Library\user\bin
D:\anaconda\Library\mingw-w64\bin