Protect projects before touching Python
Normal Python uninstall/reinstall operations target the interpreter, not source folders you created elsewhere. The real risk is losing track of dependencies or breaking virtual environments that reference the old interpreter.
Record the active setup
python -c "import sys; print(sys.executable)"
python -m pip --version
Export dependencies
If the project already uses requirements.txt,
pyproject.toml, Poetry, Pipenv, uv, Conda, or
another lock file, preserve that project metadata as the
preferred dependency record.
Do not treat the old .venv as the backup
A virtual environment points to a specific base Python installation. After the base interpreter is removed or moved, that environment can stop launching. Keep the source project and dependency metadata; rebuild the environment after reinstalling Python.
Remove only the Python installation you intend to replace
Open Windows Installed apps and identify the version tied to the broken interpreter path you recorded. Do not delete every Python entry simply because multiple versions appear. Side-by-side versions are supported and may belong to different projects.
If you use the current Python Install Manager, the manager itself and the Python runtimes it manages are separate pieces.
Install the required Python version again
For current Windows releases, Python recommends the Python Install Manager. Install a normal stable runtime with:
If a project requires a particular release, request that release explicitly.
Older Python releases may use the classic Windows executable installer from Python.org. Match the version and architecture your project expects instead of automatically moving to the newest release.
Create a fresh environment and restore dependencies
.venv\Scripts\activate
python -m pip install -r requirements-backup.txt
Then reopen the project in VS Code or another IDE and select the
new .venv interpreter. Source files, Git history,
notebooks, assets and databases stored in the project directory
remain independent from the Python application.
Verify Windows is using the new interpreter
where.exe python
python -c "import sys; print(sys.executable)"
python -m pip --version
If the path or version is still wrong, stop reinstalling. The remaining issue is usually PATH, an app execution alias, a launcher conflict, or IDE interpreter selection.
Back up what Python does not know how to recreate
- Source code, notebooks, templates, static assets and local data files that are not already committed to version control.
-
Dependency files such as
requirements.txt,pyproject.toml, lock files or Conda environment definitions. - Local databases, uploaded media and generated files stored outside the project’s normal backup process.
- A private record of environment-variable names and where their secret values are stored. Do not commit API keys or copy them into a public requirements file.
Test the backup by opening a few important files before uninstalling anything. Then recreate the virtual environment from dependency metadata. Python’s documentation treats virtual environments as disposable and not safely movable or copyable.
After restoration, run the project’s real entry point or test
suite—not only python --version. A healthy
interpreter can still be missing a dependency, native build
tool or IDE interpreter selection.
Frequently asked questions
Will reinstalling Python delete my .py files?
No, not when your projects are stored in normal project folders. The main compatibility risk is the interpreter and virtual environment, not the source files.
Should I copy site-packages before reinstalling?
Prefer exporting dependencies or using the project lock/configuration files. Copying site-packages can carry incompatible binaries and stale paths.
Can I keep the same virtual environment?
Sometimes, but recreating it is usually safer after replacing the base interpreter.
Related Python fixes
Continue with the page that matches the symptom you see after this step.
References
- Python documentation — Using Python on Windows
- Python.org — Windows downloads
- Python documentation — Virtual environments
Installation behavior and commands were checked against current Python documentation on 10 August 2026.