所以…你知道当你向另一个人解释你的问题,突然得到答案的时候吗?这是其中一次。下面是我最初的帖子,离提交只有几分钟的时间,那时我有了一个解决问题的想法!继续阅读…
我正在做一个基于电子的项目,我在vscode中调试它。部分代码生成了用Python编写的几个外部服务。这些服务刚从python 2.7迁移到python 3.7,为此我设置了一个virtualenv(我在Ubuntu 16上工作,那里仍然需要2.7,所以我不愿重新映射
python
和
pip
更新版本)。
问题是,我需要一种在调试会话开始时激活virtualenv的方法,就像电子在bash shell中启动一样(我在.bashrc中激活virtualenv)。所以我的问题是:如何在调试会话期间激活virtualenv?
为了完整起见,下面是我当前的启动配置:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Electron Shell",
"cwd": "${workspaceFolder}/dist",
"runtimeExecutable": "${workspaceFolder}/dist/node_modules/electron/dist/electron",
"runtimeArgs": ["app.js", "--remote-debugging-port=9222"],
"protocol": "inspector",
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Electron Shell",
"port": 9222,
"webRoot": "${workspaceFolder}/src",
"timeout": 30000
}
],
"compounds": [
{
"name": "Debug Angular In Electron Shell",
"configurations": [
"Attach to Electron Shell",
"Launch Electron Shell",
]
}
]
}