Python Forum
Need a script to replace an existing Python installation in a version-independent dir
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need a script to replace an existing Python installation in a version-independent dir
#1
Unfortunately Python is always installed (on Window for all users) in a version dependent directory similar to:

C:\Program Files\Python312\

Now I want to replace (!) this version COMPLETELY by a new version like 3.14.
But if I start the Python package installation for v3.14 it does not overwrite the existing installation but installed it in a new,
additional directory C:\Program Files\Python314\
I coule manually select the rpevious or another direcory as instalaltion directory but that leaves confusing uninstall entries from old Python installations as orphans in Registry.

I hate it.

Why does Python not provide a version independent one-and-only installation? At least as an user option?
WITH preserving my own, addtional previously installed modules?

This is really annoying and user unfriendly

I need a tool or Powerschell or batch script script which

1.) saves all currently installed modules
2.) uninstalls old Python from C:\Program Files\Python\
3.) Installs newest, non-beta Python Release in C:\Program Files\Python\
4.) Re-installs all my previously installed modules (see 1.)

This cannot be that difficult. This is standard update procedure for 32525 other tools.
Why not in Python? At least optional.

I don't want to fiddle around with lots of cmdline parameters.

This should run out of the box by just double click.

Is there really no such update script?
Reply
#2
Look at uv is the new standard.
Install packages a lot faster.

If want to move all packages from a version of Python to another.
Can do this but i would recommend it,it more for virtual environment.
Capture a snapshot of all currently installed Python packages and their exact versions into a text
pip freeze > requirements.txt
Recreate your environment in new Python version by running.
pip install -r requirements.txt
On windows now i have Python Python 3.13 and 3.14 install from Python.org
With uv i have about 10 version as it very easy to in install Python versions.
C:\
λ uv python list --only-installed
cpython-3.14.0-windows-x86_64-none     
cpython-3.13.10-windows-x86_64-none    
cpython-3.13.3-windows-x86_64-none   
cpython-3.13.3-windows-x86_64-none    
cpython-3.13.0-windows-x86_64-none     
cpython-3.12.10-windows-x86_64-none   
cpython-3.12.3-windows-x86_64-none     
cpython-3.12.2-windows-x86_64-none    
cpython-3.12.0-windows-x86_64-none     
cpython-3.11.15-windows-x86_64-none    
cpython-3.11.13-windows-x86_64-none    
Pedroski55 likes this post
Reply
#3
Is there a way to do this without installing another piece of software such as "uv"?

I guess there must be an update script
Reply
#4
(May-02-2026, 01:02 PM)pstein Wrote: Is there a way to do this without installing another piece of software such as "uv"?
That what i desire in first part when just use pip.
# On old python version	
pip freeze > requirements.txt

# On new Python version,this install all packages from old  
pip install -r requirements.txt
I would not do this,or alt look at requirements.txt at do some cleaing up.

Install all into a main Python can be messy,that's why virtual environment exists,
example huggingface-hub that i use for AI stuff
pip install huggingface-hub 
This one command install 166 packagesđź‘€.
Gribouillis likes this post
Reply
#5
I read now the "uv" intro but did not found a single command to replace an existing Pythn installation by a new one AND by keeping all previously installed modules. What is the uv command in detail for this?

Besides this some of you mentioned the pip command

pip freeze

and

pip install

Yes I know them. But I want to group them all together with the Python (de)installation into 1 script (.bat batch or Powershell).
I am really surprised that for such a basic task there is no corresponding script.
Reply
#6
(May-08-2026, 02:59 PM)pstein Wrote: I am really surprised that for such a basic task there is no corresponding script.
The reason is probably that the task is not as useful as you think. If nobody needs it, there is no need to write a script.

The fact is that virtualenvs enable you to run multiple versions of Python on the same machine with arbitrary sets of installed modules. It is so flexible that the global system-wide Python interpreter looks impratical.

In recent Linux systems such as Ubuntu, a mechanism prevents users from installing arbitrary packages on the systemwide Python, because this interpreter is primarily meant to run system scripts that keep the OS alive.
Pedroski55 likes this post
« We can solve any problem by introducing an extra level of indirection »
Reply
#7
Write your own Python code to do just what you want??

Good exercise in coding!

If you encounter difficulties, ask here!
Reply
#8
(Apr-19-2026, 07:17 AM)pstein Wrote: Unfortunately Python is always installed (on Windows for all users) in a version dependent directory similar to:

There are several reasons for this. Updates can cause installed modules to stop working. This is most evident with Python packages for AI. They generally lag behind the latest Python version. If Python were to overwrite all versions by default during installation, it would cause further problems.


On Linux, things work a little differently. The packages managed by the distribution are selected in such a way that dependencies remain available. Sometimes this means that, depending on the distribution’s philosophy, Python is always one or more versions behind. Even with Arch Linux, it takes various months for a new release to become available.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python version 3.11.15 install skip74 1 44 Apr-08-2026, 05:59 PM
Last Post: noisefloor
  White Screen Issue with Toolbar After Python Installation evelynfreya 3 2,340 Apr-30-2025, 06:43 AM
Last Post: encore
  Create a new subclass in a Python extension based on an existing class voidtrance 6 2,678 Mar-25-2025, 06:37 PM
Last Post: voidtrance
  Writing to two different serial ports independent of each other Aggie64 6 3,120 Dec-11-2024, 10:51 PM
Last Post: deanhystad
  Install a module to a specific to Python Installation (one of many)) tester_V 2 5,377 Oct-29-2024, 03:25 PM
Last Post: snippsat
  Shrink Python installation? Extract site-packages from .zip only on demand? pstein 4 4,334 Oct-28-2024, 04:29 PM
Last Post: snippsat
  How to find out from outside Python (in Windows) the current version of Python? pstein 5 4,540 Jun-28-2024, 07:02 AM
Last Post: Samuel34
  Troubleshooting Jupyter Notebook installation with Python using pip and a venv Drone4four 1 5,682 Jun-04-2024, 10:55 PM
Last Post: Drone4four
  run part of a script with a different version of Python jdog 3 3,862 May-27-2024, 01:57 AM
Last Post: Alice12
  Python best library for Excel reports & review of existing code MasterOfDestr 4 12,678 Feb-14-2024, 03:39 PM
Last Post: MasterOfDestr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020