- Go to your project folder
cd my-projectUse your own folder name.
- Create the environment
python3 -m venv .venvThis makes a hidden folder called .venv inside your project.
- Switch it on
source .venv/bin/activateYour prompt now starts with (.venv). Every pip install now goes into this project only.
Check it worked
- Check Python now comes from the environment
which pythonIt should end in .venv/bin/python.
Undo it
- Switch it off
deactivate - Delete the environment for good
rm -rf .venvYour own code is untouched. You can make the environment again whenever you like.
- Make sure the venv tool is installedNeeds sudo
sudo apt install -y python3-venvDebian and Ubuntu split it out. Other systems usually include it.
- Go to your project folder
cd my-projectUse your own folder name.
- Create the environment
python3 -m venv .venvThis makes a hidden folder called .venv inside your project.
- Switch it on
source .venv/bin/activateYour prompt now starts with (.venv). Every pip install now goes into this project only.
Check it worked
- Check Python now comes from the environment
which pythonIt should end in .venv/bin/python.
Undo it
- Switch it off
deactivate - Delete the environment for good
rm -rf .venvYour own code is untouched. You can make the environment again whenever you like.
- Go to your project folder
cd my-projectUse your own folder name.
- Create the environment
py -m venv .venvThis makes a hidden folder called .venv inside your project.
- Switch it on
.venv\Scripts\Activate.ps1Your prompt now starts with (.venv). Every pip install now goes into this project only. If PowerShell says scripts are disabled, run the next step once.
- Only if scripts are blocked: allow your own scripts
Set-ExecutionPolicy -Scope CurrentUser RemoteSignedThis changes the setting for your user only. Then run the activate step again.
Check it worked
- Check Python now comes from the environment
where.exe pythonThe first line should end in .venv\Scripts\python.exe.
Undo it
- Switch it off
deactivate - Delete the environment for good
Remove-Item -Recurse -Force .venvYour own code is untouched. You can make the environment again whenever you like.

New to dependency? I explain it in plain English on Layman Terms.