在Windows10上为不同的python版本安装相同的包
我的系统上安装了两个版本的 python。 (Python 2.7 和 Python 3.9.6) 任务是将 python2.7 迁移到 python3.9
由于环境变量顺序,我对 python --version 的调用导致 3.9.6。
我已经使用 pip install
安装了 modernize
、six
和 future
库。
所以我认为,它们已经安装在 python3.9.6 下
但是,由于我使用的是 modernize
、six
和 future
,我想检查一下这些库的向后兼容性。 这样做时,即:在使用 python2 解释器运行代码时,我遇到如下问题:
Traceback (most recent call last):
File "Test.py", line 2, in <module>
from six.moves import input
ImportError: No module named six.moves
任何人都可以指导我如何专门安装 python2 库吗?
I have two versions of python installed on my system. (python 2.7 and python 3.9.6)
Task is to migrate python2.7 to python3.9
Because of the environmental variable order, my call to python --version
leads to 3.9.6.
I have installed modernize
, six
and future
libraries using pip install
.
So I think, they have been installed under python3.9.6
However, since I am using modernize
,six
and future
, I would want to check the backward compatibility of these libraries.
While doing so, ie: While running the code with the python2 interpreter, I get issue as below:
Traceback (most recent call last):
File "Test.py", line 2, in <module>
from six.moves import input
ImportError: No module named six.moves
Could anyone guide me as to how to install the library for python2 specifically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题出在 pip 安装上。由于我有两个不同版本的 python,因此以 Python3 优先的方式设置路径。因此,在一些谷歌搜索中,我认为我们可以使用此处的链接将库安装到特定版本: 有多个版本
I figured that the issue was with the pip installations. Since I had two different versions of python, the path was set in a way that Python3 was of priority. So, on some googling, I figured we can install the library to a specific version using the link here: with multiple versions