copying modules from python 3.10 to 3.11 (does not work)

Question:

I am trying to copy modules from python 3.10 to 3.11.
I am using windows 11.

  • My understanding is that one just downloads and install the new version of python.
  • I make sure that python is added to path.

i follow this instruction: copying modules from python 3.10 to 3.11

i then do this:

python3.10 -m pip freeze > requirements.txt
python3.11 -m pip install -r requirements.txt

but it throws an error message:

'python3.10' is not recognized as an internal or external command,
operable program or batch file.

So i do this:

where python

to get this:

C:UsersadminAppDataLocalProgramsPythonPython311python.exe
C:UsersadminAppDataLocalProgramsPythonPython310python.exe
C:UsersadminAppDataLocalProgramsPythonPython39python.exe
C:UsersadminAppDataLocalMicrosoftWindowsAppspython.exe

I note the guidance here: https://pip.pypa.io/en/stable/cli/pip_freeze/
which states this:

env1binpython -m pip freeze > requirements.txt
env2binpython -m pip install -r requirements.txt

So my question is, with my paths and the above instruction, how do I implement the correct command so that all the packages are successfully updated in the new python version?

update:

is this the correct implementation ?

C:UsersadminAppDataLocalProgramsPythonPython310python -m pip freeze > requirements.txt
C:UsersadminAppDataLocalProgramsPythonPython311python -m install -r requirements.txt

And if so do i need to copy the requirements.txt file to the new path ?

Asked By: D.L

||

Answers:

You can specify full path of python,

C:UsersadminAppDataLocalProgramsPythonPython310python.exe -m pip freeze > requirements.txt
C:UsersadminAppDataLocalProgramsPythonPython311python.exe -m pip install -r requirements.txt

or It would be better for you to create a link for python in the same directory,

cd C:UsersadminAppDataLocalProgramsPython
mklink Python310python3.10.exe Python310python.exe
mklink Python311python3.11.exe Python311python.exe

Later on when you want to use python3.xx, just type python3.xx it will work. Now you can use the same command you are using.

Answered By: Lokesh Kurre
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.