在 Cygwin 上安装新版本的 Python 不会安装 Pip?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30863501/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing new versions of Python on Cygwin does not install Pip?
提问by redyoshi49q
While I am aware of the option of installing Pip from source, I'm trying to avoid going down that path so that updates to Pip will be managed by Cygwin's package management.
虽然我知道从 source 安装 Pip的选项,但我试图避免走这条路,以便对 Pip 的更新将由 Cygwin 的包管理管理。
I've recently learnedthat the latest versions of Python include Pip. However, even though I have recently installed the latest versions of Python from the Cygwin repos, Bash doesn't recognize a valid Pip install on the system.
我最近了解到最新版本的 Python 包括 Pip。但是,即使我最近从 Cygwin 存储库安装了最新版本的 Python,Bash 也无法识别系统上的有效 Pip 安装。
896/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:22am CDT) [0 jobs]
[ethan@firetail: +2] ~ $ python -V
Python 2.7.10
892/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:27am CDT) [0 jobs]
[ethan@firetail: +2] ~ $ python3 -V
Python 3.4.3
883/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:34am CDT) [0 jobs]
[ethan@firetail: +2] ~ $ pip
bash: pip: command not found
878/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:41am CDT) [0 jobs]
[ethan@firetail: +2] ~ $ pip2
bash: pip2: command not found
876/4086 MB RAM 0.00 0.00 0.00 1/12 Tue, Jun 16, 2015 ( 3:53:42am CDT) [0 jobs]
[ethan@firetail: +2] ~ $ pip3
bash: pip3: command not found
Note that the installed Python 2.7.10 and Python 3.4.3 are both recent enough that they should include Pip.
请注意,安装的 Python 2.7.10 和 Python 3.4.3 都足够新,它们应该包含 Pip。
Is there something that I might have overlooked? Could there be a new install of Pip that isn't in the standard binary directories referenced in the $PATH? If the Cygwin packages of Python do in fact lack an inclusion of Pip, is that something that's notable enough to warrant a bug report to the Cygwin project?
有什么我可能忽略的吗?是否有新安装的 Pip 不在 $PATH 中引用的标准二进制目录中?如果 Python 的 Cygwin 包实际上没有包含 Pip,那么这是否足以保证向 Cygwin 项目报告错误?
回答by Cecil Curry
celself-answered this question in a comment above. For posterity, let's convert this helpfully working solution into a genuine answer.
cel在上面的评论中自我回答了这个问题。为了后代,让我们将这个有用的解决方案转化为真正的答案。
Unfortunately, Cygwin currently fails to:
不幸的是,Cygwin 目前无法:
- Provide
pip
,pip2
, orpip3
packages. - Install the
pip
andpip2
commands when thepython
package is installed. - Install the
pip3
command when thepython3
package is installed.
- 提供
pip
,pip2
或pip3
包。 - 安装包时安装
pip
和pip2
命令python
。 - 安装包
pip3
时安装命令python3
。
It's time to roll up our grubby command-line sleeves and get it done ourselves.
是时候卷起我们肮脏的命令行袖子并自己完成它了。
What's the Catch?
什么是Catch?
Since nopip
packages are currently available, the answer to the specific question of "Is pip
installable as a Cygwin package?" is technically "Sorry, son."
由于当前没有pip
可用的软件包,因此请回答“是否可以pip
作为 Cygwin 软件包安装?”这一特定问题的答案。严格来说是“对不起,儿子”。
That said, pip
istrivially installable via a one-liner. This requires manually re-running said one-liner to update pip
but has the distinct advantage of actually working. (Which is more than we usually get in Cygwin Land.)
也就是说,pip
可以通过单线轻松安装。这需要手动重新运行所述单行程序进行更新,pip
但具有实际工作的明显优势。(这比我们通常在 Cygwin Land 中得到的要多。)
pip3
Installation, Please
pip3
安装,请
To install pip3
,the Python 3-specific version of pip
, under Cygwin:
要安装pip3
,的Python 3的特定版本pip
,在Cygwin下:
$ python3 -m ensurepip
This assumes the python3
Cygwin package to have been installed, of course.
当然,这假设python3
已经安装了Cygwin 包。
pip2
Installation, Please
pip2
安装,请
To install both pip
and pip2
,the Python 2-specific versions of pip
, under Cygwin:
同时安装pip
和pip2
,的Python的2特定的版本pip
,在Cygwin下:
$ python -m ensurepip
This assumes the python
Cygwin package to have been installed, of course.
当然,这假设python
已经安装了Cygwin 包。
回答by moovon
Download a helper package:
- For Python 2.x install the
python-setuptools
package. - For Python 3.x install the
python3-setuptools
package.
- For Python 2.x install the
Run the script:
- For Python 2.7 run:
easy_install-2.7 pip
- For Python 3.4 run:
easy_install-3.4 pip
- For Python 2.7 run:
下载帮助包:
- 对于 Python 2.x,安装
python-setuptools
包。 - 对于 Python 3.x,安装
python3-setuptools
包。
- 对于 Python 2.x,安装
运行脚本:
- 对于 Python 2.7 运行:
easy_install-2.7 pip
- 对于 Python 3.4 运行:
easy_install-3.4 pip
- 对于 Python 2.7 运行: