简体   繁体   English

无法在python 3.4和2.7的pip之间切换[Windows]

[英]Can't switch between pip for python 3.4 and 2.7 [Windows]

I have python 3.4 installed on my windows for a while but now I need to get 2.7 to work another project. 我在Windows上安装了python 3.4一段时间,但是现在我需要2.7才能运行另一个项目。 I downloaded the 2.7.10 package from the official python and installed it. 我从官方python下载了2.7.10软件包并安装了它。 Everything was fine until I tried to install packages using pip. 一切都很好,直到我尝试使用pip安装软件包。

What I have read in different places is that pip-2.7 should work but the command is not recognized. 我在不同地方阅读的内容是pip-2.7应该可以工作,但是命令无法识别。 If I get get-pip.py to try to install pip using py get-pip.py it tells me it's already installed. 如果我得到get-pip.py尝试使用py get-pip.py安装pip,它会告诉我它已经安装。

So is there anyway to get this working? 那么有什么要使它起作用吗?

Taken from the docs 取自文档

py -2 -m pip install SomePackage # default Python 2 py -2 -m pip install SomePackage#默认为Python 2

py -2.7 -m pip install SomePackage # specifically Python 2.7 py -2.7 -m pip install SomePackage#特别是Python 2.7

py -3 -m pip install SomePackage # default Python 3 py -3 -m pip install SomePackage#默认为Python 3

py -3.4 -m pip install SomePackage # specifically Python 3.4 py -3.4 -m pip install SomePackage#特别是Python 3.4

So in your case you'll need either of the two: 因此,在您的情况下,您将需要以下两个之一:

py -2   -m pip install SomePackage  # default Python 2
py -2.7 -m pip install SomePackage  # specifically Python 2.7

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

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