analitics

Pages

Wednesday, July 13, 2022

Python 3.11.0a7 : local script for update python packages.

If you want to upgrade all local packages from a local script for pip with version greater than 10.0.1 version use a local python script with this source code:
import pkg_resources
from subprocess import call

packages = [dist.project_name for dist in pkg_resources.working_set]
call("pip install --upgrade " + ' '.join(packages), shell=True)
Run it with the python executable and you will see something like this:
C:\Python311alpha>python.exe update_python.py
...
Requirement already satisfied: pip-api in c:\python311alpha\lib\site-packages (0.0.29)
Requirement already satisfied: pypng in c:\python311alpha\lib\site-packages (0.0.21)
Requirement already satisfied: PyGetWindow in c:\python311alpha\lib\site-packages (0.0.9)
Requirement already satisfied: bs4 in c:\python311alpha\lib\site-packages (0.0.1)