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

Time:02-06

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:\Users\admin\AppData\Local\Programs\Python\Python311\python.exe
C:\Users\admin\AppData\Local\Programs\Python\Python310\python.exe
C:\Users\admin\AppData\Local\Programs\Python\Python39\python.exe
C:\Users\admin\AppData\Local\Microsoft\WindowsApps\python.exe

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

env1\bin\python -m pip freeze > requirements.txt
env2\bin\python -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:\Users\admin\AppData\Local\Programs\Python\Python310\python -m pip freeze > requirements.txt
C:\Users\admin\AppData\Local\Programs\Python\Python311\python -m install -r requirements.txt

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

CodePudding user response:

You can specify full path of python,

C:\Users\admin\AppData\Local\Programs\Python\Python310\python.exe -m pip freeze > requirements.txt
C:\Users\admin\AppData\Local\Programs\Python\Python311\python.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:\Users\admin\AppData\Local\Programs\Python\
mklink Python310\python3.10.exe Python310\python.exe
mklink Python311\python3.11.exe Python311\python.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.

  • Related