Issue
I am working on a Linux environment and have created my virtual environment using the pyenv
tool. I have set the local virtual environment in my working folder the the one I want with pyenv
from command line like this for example : pyenv local my_venv_name
which in my case my_venv_name=3.9.9
When I opened VSCode in that folder the integrated terminal is indeed opening that virtual environment BUT the code in the VSCode seems to not be able to find some installed dependencies that I can see that I have installed in that particular environment. I can do pip freeze
in the terminal and I see the packages but VSCode does not see them.
How can I set the correct virtual environment to the VSCode editor?
Solution
Ok so you have to select the correct python interpreter because pyenv
could be using multiple python version in different environments. I found two ways to change it:
Open the
command palette
either from the gear icon bottom left corner or by typingCtrl + Shift + P
. Then typeselect python interpreter
and select the one that corresponds to the virtual environment you wantYou can find the same option by simply clicking and selecting the interpreter from the bottom right corner of the VSCode as shown in the image below:
Answered By - KZiovas Answer Checked By - David Goodson (WPSolving Volunteer)