当默认的pip2是pip2时,升级pip3的正确格式是什么? [英] What is the correct format to upgrade pip3 when the default pip is pip2?
问题描述
我为Python 2
和3.
开发
因此,我必须同时使用pip2
和pip3.
I develop for both Python 2
and 3.
Thus, I have to use both pip2
and pip3.
使用pip3 -
时,我收到此升级请求(最后两行):
When using pip3 -
I receive this upgrade request (last two lines):
$ pip3 install arrow
Requirement already satisfied (use --upgrade to upgrade): arrow in c:\program files (x86)\python3.5.1\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in c:\program files (x86)\python3.5.1\lib\site-packages (from arrow)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in c:\program files (x86)\python3.5.1\lib\site-packages (from python-dateutil->arrow)
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
我的默认pip
用于Python 2,
,即:
$ python -m pip install --upgrade pip
Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages
但是,以下所有 explicit 命令都无法成功升级Python 3 pip:
However, none of the following explicit commands succeed in upgrading the Python 3 pip:
$ python -m pip3 install --upgrade pip3
/bin/python: No module named pip3
$ python -m pip install --upgrade pip3
Collecting pip3
Could not find a version that satisfies the requirement pip3 (from versions: )
No matching distribution found for pip3
$ python -m pip install --upgrade pip3.4
Collecting pip3.4
Could not find a version that satisfies the requirement pip3.4 (from versions: )
No matching distribution found for pip3.4
不是默认pip的升级pip3的正确命令是什么?
环境:
$ python3 -V
Python 3.4.3
$ uname -a
CYGWIN_NT-6.1-WOW 2.5.2(0.297/5/3) 2016-06-23 14:27 i686 Cygwin
推荐答案
只需使用您已经拥有的pip3
命令:
Just use the pip3
command you already have:
pip3 install --upgrade pip
已安装的项目始终称为pip
. pip3
命令与Python 3安装相关,并且是pip
的别名,但是后者在Python 2设置中被pip
命令遮盖了.
The installed project is called pip
, always. The pip3
command is tied to your Python 3 installation and is an alias for pip
, but the latter is shadowed by the pip
command in your Python 2 setup.
您也可以使用关联的Python二进制文件来完成此操作;如果它可以作为python3
可执行文件,则使用该文件:
You can do it with the associated Python binary too; if it executable as python3
, then use that:
python3 -m pip install --upgrade pip
同样,该项目被称为pip
,安装到您的site-packages
目录中的模块也是如此,因此对于-m
命令行选项和install
命令都请使用该名称.
Again, the project is called pip
, and so is the module that is installed into your site-packages
directory, so stick to that name for the -m
command-line option and for the install
command.
这篇关于当默认的pip2是pip2时,升级pip3的正确格式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!