简体   繁体   English

如何将站点包从文件夹 Python37 移动到文件夹 Python310?

[英]How to move site-package from folder Python37 to folder Python310?

Recently, in I download and install Python 3.10, then uninstall Python 3.7 in win10.However, when I want to import some modules in script, it shows there is no modules.最近在win10中下载并安装了Python 3.10,然后卸载了Python 3.7。但是,当我想在脚本中导入一些模块时,显示没有模块。 After checking, I found all modules are still saved in C:\Users\...\AppData\Roaming\Python\Python37 So if I want to use them, just copy/paste them into Python310 ?检查后,我发现所有模块仍然保存在C:\Users\...\AppData\Roaming\Python\Python37所以如果我想使用它们,只需将它们copy/pastePython310 Need I change other things, like classpath...我需要更改其他内容,例如类路径...

If not, what should I do?如果没有,我该怎么办? download from Inte.net again?再次从 Inte.net 下载?

Don't copy site site-packages dir from one version of Python to another - at best you'll get undefined behaviour.不要将 site site-packages目录从一个版本的 Python 复制到另一个版本 - 充其量你会得到未定义的行为。 The appropriate way of getting the modules you want from v3.7 to v3.10 is to run pip list from the v3.7 installation to see what you have installed, then pip freeze to write that to a file, and finally use the v3.10 pip to install from the file that you wrote the list to.从 v3.7 到 v3.10 获取所需模块的适当方法是从 v3.7 安装运行pip list以查看已安装的内容,然后pip freeze将其写入文件,最后使用 v3 .10 pip 从您写入列表的文件进行安装。

This way you will get the modules built with and for v3.10.这样您将获得使用 v3.10 构建的模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM