virtual env Python
Step 1: Existing Virtual Environment
- files used by different tools.
| File | Tool | 
|---|---|
| Pipfile / Pipfile.lock | Pipenv | 
| pyproject.toml | Poetry or modern Python projects | 
| requirements.txt | Plain pip / venv | 
| .venv/ folder | Manual venv (preferred method) | 
| poetry.lock | Poetry | 
| environment.yml | Conda | 
| .python-version | pyenv | 
If you spot venv files, then:
pipenv --venv
To find source for current venv:
source example /Users/gregdyche/.local/share/virtualenvs/projects-TRsZtRyMVS Code: Open the folder.
Press Cmd + Shift + P and select Python: Select Interpreter
- find the one related to the virtual environment, in this case projects-TRsZtRyM
Step 2: Activate the Virtual
If .venv files, then:
pipenv shellStep 3: Exit the Virtual Environment
When finished, deactivate the environment:
exit1. Double check correct python is being used?
Run this in terminal or a Python shell:
which pythonor in Windows:
where pythonThen check if the path includes .venv, env, or pipenv — that’s a strong clue you’re in a virtual environment.
2. Which interpreter is being used (especially in VS Code)?
Open the Command Palette:
Cmd/Ctrl + Shift + P → “Python: Select Interpreter”
It will show the path and type of environment.