Skip to main content

python venv commands

create a virtual environment in current directory

python -m venv my_venv

create a virtual environment in a specific dirctory

python -m venv path/to/your/venv/my_venv

activate a virtual environment using powershell from the venv/scripts folder

./Activate.ps1

deactivate a virtual environment using powershell from the venv/scripts folder

deactivate

remove/delete a virtual environment (just delete the directory)

rm -rf /path/to/my_venv

clear an existing virtual environment

python -m venv --clear path/to/my_venv

update python version in a virtual environment

python -m venv /path/to/my_venv --upgrade

give virtual environment access to system site-packages

python -m venv /path/to/my_venv --system-site-packages

skip pip installation and/or upgrade

python -m vevn /path/to/my_venv --without-pip

🌍