【发布时间】:2018-12-04 13:31:25
【问题描述】:
Python 环境的自动采购/启用是一个很棒的功能!但我不知道如何为任务禁用它。例如,Pyenv 会自动激活并在其 virtualenv 中运行命令,因此我的 pipenv 运行命令最终会出错。 我用这种行为制作了一个小 GIF。
作为参考,这是我的 .vscode/tasks.json 文件
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [{
"label": "Run IPython Shell",
"problemMatcher": [],
"type": "shell",
"command": "pipenv run ipython",
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}]
}
输出如下:
> Executing task: pipenv run ipython <
source /Users/nahuel/.virtualenvs/pysrv-RjlHvHY5/bin/activate
Python 3.6.6 (default, Aug 6 2018, 12:14:58)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.1.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: source /Users/nahuel/.virtualenvs/pysrv-RjlHvHY5/bin/activate
File "<ipython-input-1-944ce73c2717>", line 1
source /Users/nahuel/.virtualenvs/pysrv-RjlHvHY5/bin/activate
^
SyntaxError: invalid syntax
In [2]:
【问题讨论】:
标签: python visual-studio-code task virtualenv pipenv