我正在尝试使用虚拟环境与Visual Studio Code一起工作。在Launch JSON中,我像这样指定了nosetests启动:
{
"name": "nosetests",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"program": "${workspaceRoot}/env/dev/bin/nosetests",
"args": [
"--nocapture",
"tests"
],
"externalConsole": false,
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
},
但是当我启动时,环境变量并没有被识别。我尝试在工作区设置中设置Python路径:
"python.pythonPath": "${workspaceRoot}/env/dev/bin/python"
但是它似乎没有设置正确的环境。需要有类似于 "source activate" 的东西。有人解决了这个问题吗?
launch.json
中指定 Python 路径的键现在只是python
,例如{ ... "python": "${workspaceRoot}/env/dev/bin/python" ... }
。 - Govind Rai