Activating Anaconda Environment in VsCode

后端 未结 10 1023
囚心锁ツ
囚心锁ツ 2020-11-30 22:32

I have Anaconda working on my system and VsCode working, but how do I get VsCode to activate a specific environment when running my python script?

10条回答
  •  离开以前
    2020-11-30 22:50

    Although approved answer is correct, I want to show a bit different approach (based on this answer).

    Vscode can automatically choose correct anaconda environment if you start vscode from it. Just add to user/workspace settings:

    {
        "python.pythonPath": "C://Anaconda3/envs/${env:CONDA_DEFAULT_ENV}/python"
    }
    

    It works on Windows, macOS and probably Unix. Further read on variable substitution in vscode: here.

提交回复
热议问题