我有一个无法解决的非常简单的问题:当我使用 vscode 在集成终端中运行任何 python 代码时,我可以使用我在 Anaconda 上创建的虚拟环境,但是当我尝试调试或使用“运行代码”按钮时,他很清楚不使用我的实际环境(因此,不要找到我的模块)。
我的设置 Json:
{
"python.pythonPath": "C:\\Users\\Giovani\\anaconda3\\python.exe",
"python.autoComplete.addBrackets": true,
"python.jediEnabled": false,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"editor.detectIndentation": false,
"python.terminal.executeInFileDir": true,
"editor.tabSize": 4 }
和 Lauch.json:
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
] }
显示问题的图像:在集成终端中运行没有问题:在终端中运行
目标:使用与调试器上的“python.pythonPath”或“运行代码”按钮相同的虚拟环境。
尝试从激活的 conda 环境启动 VS Code。然后从 VS Code 中选择您通过运行Python: Select Interpreter
命令激活的环境。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句