I’ve read through VS Code’s documentation on creating a virtual environment and I’ve used the venv
command to do so, but how do I know if my current Python files are working using that Virtual Environment?
In the folder I’m saving my .py files in, I see the .venv folder which was created. Is that it or is there more to it?
I’ve used VS Code’s terminal commands and followed the documentation instructions, but there is no documentation to tell me exactly what I’m supposed to see when it works, so I don’t know if I’m done.
Type which python
into VS Code's integrated terminal.
If you are using the venv, it will show the path to the python executable inside the venv. For example, for me, the .venv folder is located in /Users/lion/example_folder
, but for you the path would be different.
If the path does not include the .venv folder inside your Python Projects folder, then you are not inside the venv. For example, the path shown by the command is /usr/bin/python
, but the .venv is at /user/Python Projects
.
Inside VS Code's terminal, type source .venv/bin/activate
(or specify the absolute path source ~/example_folder/.venv/bin/activate
).