Upgrade the environment after the base interpreter changed.
Section: Create environments
Upgrade an existing environment after Python upgrade
bash
bash
python -m venv --upgrade .venvExplanation
Use this when the underlying Python installation was upgraded and you want the environment updated.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Create environments
Create a .venv environment
Create a conventional project-local virtual environment.
Create with python3
Use python3 explicitly on systems where python points elsewhere.
Customize the shell prompt name
Set the prompt label shown when the environment is active.
Create with Windows py launcher
Create an environment using the Windows Python launcher.
Create with a specific Python version
Use a specific interpreter to choose the base Python version.