Activating Anaconda Environment in VScode

Activating Anaconda Environment in VsCode

If Anaconda is your default Python install then it just works if you install the Microsoft Python extension.

The following should work regardless of Python editor or if you need to point to a specific install:

In settings.json edit python.path with something like

"python.pythonPath": "C:\\Anaconda3\\envs\\py34\\python.exe"

Instructions to edit settings.json

Working with Anaconda in Visual Studio Code

Activating a conda environment does not place conda on your PATH. You need to launch the Anaconda Prompt app from your Start menu to get a command-line with conda on your PATH if you didn't check the box to include conda during installation.

Also realize that conda only supports PowerShell as of conda 4.6 which was released in January 2019.

And the Python extension for VS Code works with conda fine. Create a conda environment and the extension will allow you to select it as your environment/interpreter.

How to activate conda environment in VSCode on Windows 10

Your '$' indicates to me that you are not actually having a Command Line prompt open, but rather an alternative (probably bash?).

Press Ctrl+Shift+P and search for 'Select default shell', change to Command Line prompt and you should be good to go :)

Sample Image

Visual Studio Code terminal doesn't activate Conda environment

First, open the Anaconda prompt (How to access Anaconda command prompt in Windows 10 (64-bit)), and type:

conda activate tom

To activate your virtual environment.

Then to open Visual Studio Code in this active environment, type

code

And it should work.



Related Topics



Leave a reply



Submit