在 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 09:06:26  来源:igfitidea点击:

Installing new versions of Python on Cygwin does not install Pip?

pythoncygwinpip

提问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, or pip3packages.
  • Install the pipand pip2commands when the pythonpackage is installed.
  • Install the pip3command when the python3package is installed.
  • 提供pippip2pip3包。
  • 安装包时安装pippip2命令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 nopippackages are currently available, the answer to the specific question of "Is pipinstallable as a Cygwin package?" is technically "Sorry, son."

由于当前没有pip可用的软件包,因此请回答“是否可以pip作为 Cygwin 软件包安装?”这一特定问题的答案。严格来说是“对不起,儿子”。

That said, pipistrivially installable via a one-liner. This requires manually re-running said one-liner to update pipbut has the distinct advantage of actually working. (Which is more than we usually get in Cygwin Land.)

也就是说,pip可以通过单线轻松安装。这需要手动重新运行所述单行程序进行更新,pip但具有实际工作的明显优势。(这比我们通常在 Cygwin Land 中得到的要多。)

pip3Installation, 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 python3Cygwin package to have been installed, of course.

当然,这假设python3已经安装了Cygwin 包。

pip2Installation, Please

pip2安装,请

To install both pipand pip2,the Python 2-specific versions of pip, under Cygwin:

同时安装pippip2的Python的2特定的版本pip,在Cygwin下:

$ python -m ensurepip

This assumes the pythonCygwin package to have been installed, of course.

当然,这假设python已经安装了Cygwin 包。

回答by moovon

  1. Download a helper package:

  2. Run the script:

    • For Python 2.7 run: easy_install-2.7 pip
    • For Python 3.4 run: easy_install-3.4 pip
  1. 下载帮助包:

  2. 运行脚本:

    • 对于 Python 2.7 运行: easy_install-2.7 pip
    • 对于 Python 3.4 运行: easy_install-3.4 pip