ubuntu24.04 中vscode1.96如何在 settings.json 设置激活python3.7 虚拟环境
环境:ubuntu24.04 + vscode1.96 + 虚拟环境 /opt/pyenv/pyenv3.7
注意:环境 有多个不同版本的 python 虚拟环境
点击终端无法激活虚拟环境,只能通过手动输入命令,或 设置–》选择 python 解释器才行,难道配置文件不行,还是抛弃了。```bash
source /opt/pyenv/pyenv3.7/bin/activate
使用方法一:
```bash
{
"terminal.integrated.profiles.linux": {
"pyenv": {
"path": "bash",
"args": [
"-c",
"source /opt/pyenv/pyenv3.7/bin/activate; bash"
]
}
},
"terminal.integrated.defaultProfile.linux": "bash"
}
或改为
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"args": [
"-c",
"source /opt/pyenv/pyenv3.7/bin/activate"
]
}
},
"terminal.integrated.defaultProfile.linux": "bash"
或改为
{
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"args": [
"-l",
"-c",
"source /opt/pyenv/pyenv3.7/bin/activate; exec bash",
],
"icon": "terminal-bash"
}
},
"terminal.integrated.defaultProfile.linux": "bash"
}
使用方法二:
{
"terminal.integrated.shellArgs.linux": ["source /opt/pyenv/pyenv3.7/bin/activate"]
}
打开终端,无法激活虚拟环境,只能手动操作,才行
source /opt/pyenv/pyenv3.7/bin/activate