Issue
In my project folder I created a venv folder:
python -m venv venv
When I run command select python interpreter
in Visual Studio Code, my venv folder is not shown. I went one level up like suggested here, but Visual Studio Code doesn't see my virtual interpreter.
What did I miss?
Solution
P.S.:
I have been using Visual Studio Code for a while now and found an another way to show virtual environments in Visual Studio Code.
Go to the parent folder in which
venv
is there through a command prompt.Type
code .
and Enter. [It is working on both Windows and Linux for me.]That should also show the virtual environments present in that folder.
Original Answer
I almost run into same problem every time I am working on Visual Studio Code using venv. I follow the below steps:
Go to menu File → Preferences → Settings.
Click on Workspace settings.
Under Files:Association, in the JSON: Schemas section, you will find Edit in settings.json. Click on that.
Update
"python.pythonPath": "Your_venv_path/bin/python"
under workspace settings. (For Windows): Update"python.pythonPath": "Your_venv_path/Scripts/python.exe"
under workspace settings.Restart Visual Studio Code in case if it still doesn't show your venv.
Answered By - Sumit S Chawla