pip3.4 -V表示python2.7安装 [英] pip3.4 -V refers to python2.7 installation

查看:230
本文介绍了pip3.4 -V表示python2.7安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修改后的问题以减少误导

pip3和pip2之间有区别吗? pip2 -Vpip3-V都产生输出

Is there a difference between pip3 and pip2? pip2 -V and pip3-V both produce the output

/usr/lib/python2.7/site-packages(python 2.7)中的pip 7.1.0

pip 7.1.0 from /usr/lib/python2.7/site-packages (python 2.7)

下面的旧问题

我看到了使用pip3设置python3 virtualenv的建议,但是当我键入

I have seen recommendations to set up a python3 virtualenv using pip3, but when I type

pip3.4 -V

我得到了输出

pip 7.1.0 from /usr/lib/python2.7/site-packages (python 2.7)

我从pip -Vpip2 -V获得的输出完全相同.我的python3安装正常.这是怎么回事? pip,pip2和pip3实际上是一回事吗?毕竟 https://pip.pypa.io/en/stable/index.html,仅提及点子.此外,奇怪的是,在我的/usr/bin文件夹中,我可以看到我的pip3比我的pip3.4二进制文件还旧-这解释了为什么pip3 -V失败并

Which is exactly the same output I get from pip -V and pip2 -V. My python3 installation works fine. What's the deal? Is pip, pip2, and pip3, actually the same thing? Afterall https://pip.pypa.io/en/stable/index.html, only mentions pip. Furthermore strangely, in my /usr/bin folder, I can see my pip3 is older than my pip3.4 binary -- which explains why pip3 -V fails with

pkg_resources.DistributionNotFound: pip==1.5.6

那是怎么回事? pip3语法是否多余,或者我的系统有问题?我使用opensuse 13.2

So what is the deal? is the pip3 syntax redundant, or is there something wrong with my system? I use opensuse 13.2

推荐答案

在Debian中,我在/usr/local/bin中找到了三个短文件:pip; pip3;和pip3.4.都一样:

In Debian, I found three short files in /usr/local/bin: pip; pip3; and pip3.4. All were identical:

#!/usr/bin/python

# -*- coding: utf-8 -*-
import re
import sys

from pip import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

通过将pip3(使用sudo)的第一个shebang行更改为

By changing the very first shebang line of pip3 (with sudo) to

#!/usr/bin/python3

然后确保原始点是明确的

Then ensuring that the original pip was explicitly

#!/usr/bin/python2

我所有类似的困惑和错误都消失了.

All of my similar confusion and errors disappeared.

这篇关于pip3.4 -V表示python2.7安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆