Python Forum

Full Version: Installation of packages to newest Python version from previous one
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
Is it possible to check what python packages are installed let's say into my present 3.10.3 version
and get that list and somehow install it to 3.11 version all together ?
That would be good solution instead installing them one by one.
(Jul-15-2023, 07:21 AM)Andrzej_Andrzej Wrote: [ -> ]Is it possible to check what python packages are installed let's say into my present 3.10.3 version
and get that list and somehow install it to 3.11 version all together
Yes there is but i would not requirement it all for main Python version more for virtual environment.
Talking about to use of pip list and pip freeze to a requirements.txt.
By your previous post you use Windows,if Python 3.11 is in you OS Path for Windows use this to list what install to 3.10.
# list all installed to 3.10
py -3.10 -m pip list 

# 3.11 if that in OS path
pip list

# Or
py -m pip list
If freeze to requirements.txt that can install that 3.11,but would not recommend this at all.
See that it freeze to version when was installed,and don't consider newer versions.
py -3.10 -m pip freeze > requirements.txt
# Install to 3.11,but no no
pip install -r requirements.txt

So what to do?
Just install manually can use pip list as refences,or something like pip-chill.
Learn to use virtual environment if have a project that have many dependencies.
Eg install 3 or more packages would be like this,here in virtual environment.
(new_env) G:\div_code\new_env
λ pip install requests pip-chill click
.....
Successfully installed click-8.1.5 requests-2.31.0 colorama-0.4.6 pip-chill-1.0.3
# Or if put same packages a req.txt,and use this file to install
pip install -r req.txt
Requirement already satisfied: requests in g:\div_code\new_env\lib\site-packages (from -r req.txt (line 1)) (2.31.0)
.....
Thank you,

What kind of command can give me detailed info about all python installations in my windows, by detailed I mean that if I have got 3.10.4, it will display it like that, not short version like 3.10 ?
And I want to know where all those versions are installed ? I am googling but not found such a code like in one-liner piece.
(Jul-15-2023, 11:00 AM)Andrzej_Andrzej Wrote: [ -> ]by detailed I mean that if I have got 3.10.4, it will display it like that, not short version like 3.10 ?
Usually do not have two separate 3.10 versions,as just upgrade is the normally way to do in Windows.
So if upgrade to newest eg Python 3.10.12,that is the only one of 3.10 should have.
Use py to list versions.
py --list

# As py is cli tool is has help
py --help