How can I launch an exe within a conda env

旧时模样 提交于 2019-12-04 08:31:25

You might want to run source activate env-name as a task in visual studio. https://code.visualstudio.com/Docs/editor/tasks

tasks.json

{
    "version": "0.1.0",
    "command": "cmd",
    "isShellCommand": true,
    "suppressTaskName": true,
    "args": [],
    "tasks": [
        {
            "taskName": "development",
            "args": ["source", "activate", "env-name"]
        }
    ]
}

The best option I found is to set the python.venvPath parameter in vscode settings to your anaconda envs folder.

"python.venvPath": "/Users/[...]/Anaconda3/envs"

Then if you bring up the command palette (ctl + shift + P on windows/linux, cmd + shift + P on mac) and type Python: Select Workspace Interpreter all your envs will show up and you can select which env to use.

The python extension will also need to be installed for the Select Workspace Interpreter option.

Note: The Select Workspace Interpreter takes around 10 seconds to come up on my computer using the current version of VSCode. My answer was originally posted here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!