复制模块从Python 3.10到3.11(不起作用)。

huangapple go评论76阅读模式
英文:

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

问题

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: https://stackoverflow.com/questions/74190755/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?

英文:

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: https://stackoverflow.com/questions/74190755/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 ?

答案1

得分: 1

你可以指定 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

或者更好的做法是在相同目录下为 Python 创建一个链接,

cd C:\Users\admin\AppData\Local\Programs\Python\
mklink Python310\python3.10.exe Python310\python.exe
mklink Python311\python3.11.exe Python311\python.exe

之后,当你想要使用 python3.xx 时,只需键入 python3.xx 即可。现在你可以使用相同的命令。

英文:

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.

huangapple
  • 本文由 发表于 2023年2月6日 03:19:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/75354886.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定