Skip to content
Advertisement

Visual Studio Code terminal doesn’t activate Conda environment

I read this Stack Overflow post on a similar issue, but the suggestions there don’t seem to be working. I installed Visual Studio Code on my Windows machine and added the Python extension. Then I changed the Python path for my project to C:Usersusername.condaenvstompython.exe. The .vscode/settings.json has this in it:

JavaScript

The status bar in Visual Studio Code also shows:

Enter image description here

But when I do conda env list even after doing conda activate tom in the terminal I get the output:

JavaScript

Instead of:

JavaScript

Also the packages not installed in base don’t get imported when I try python app.py. What should I do?

where python runs, but it doesn’t give any output.

Also,

JavaScript

gives

JavaScript

Advertisement

Answer

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

JavaScript

To activate your virtual environment.

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

JavaScript

And it should work.

Advertisement