Python - 有没有办法在没有 setuptools 的情况下获取 pip?
他们需要包管理器来安装包管理器,这似乎有点奇怪。顺便说一句,我在 Windows 上。
Seems kinda weird that they'd require a package manager to install a package manager. I'm on Windows BTW.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Pip 确实需要安装工具。 Pip 实际上只是 setuptools 的一个包装器,提供比 easy_install 更好的安装程序和一些更好的安装行为,以及卸载、需求文件等。即使您以某种方式在没有 setuptools 的情况下安装了 pip,没有它它仍然无法运行。
Pip does require setuptools. Pip is really just a wrapper around setuptools to provide a better installer than easy_install and some nicer installation behaviors, plus uninstall, requirements files, etc. Even if you somehow got pip installed without setuptools it still won't run without it.
您可以使用
Distribute
而不是setuptools
:它会安装一个名为setuptools
的软件包(它是后者的分支)。您可以通过下载并运行distribute_setup.py
来安装 Distribute。更新: 正如 Gringo Suave 所说,以上内容现在已过时 -
distribute
和setuptools
现已合并,合并后的项目称为安装工具
。You can use
Distribute
instead ofsetuptools
: it installs a package calledsetuptools
(it's a fork of the latter). You can install Distribute by downloading and runningdistribute_setup.py
.Update: As Gringo Suave says, the above is obsolete now -
distribute
andsetuptools
have now merged, and the merged project is calledsetuptools
.您可以从 pypi/setuptools 下载
setuptools
软件包作为 Windows 安装程序,然后安装pip
或easy_install
You can download
setuptools
package as Windows installer from pypi/setuptools and then installpip
oreasy_install
Windows 用户的解决方案
如果您在 Windows 上安装了 ActivePython,那么默认情况下您也拥有 pip作为 PyPM(ActiveState 的包管理器)。以下摘录自 ActivePython 2.7 中包含的内容:
OS X 用户的解决方案
不确定使用 pip 安装时是否需要
setuptools
a href="https://brew.sh/" rel="nofollow noreferrer">自制程序。你可以尝试一下。安装 homebrew:
然后安装 pip:
Solution for Windows Users
If you installed ActivePython on Windows, then you have pip by default, as well as PyPM (ActiveState's package manager). The following excerpt is from What's included in ActivePython 2.7:
Solution for OS X Users
Not sure if
setuptools
is required when installing pip using homebrew. You might try that.To install homebrew:
Then to install pip:
当然,只需从 http://pypi.python.org/pypi/ 获取源代码pip/0.8.2#downloads
解压它,cd 进入它,然后运行
python setup.py install
Sure, just grab the source from http://pypi.python.org/pypi/pip/0.8.2#downloads
unpack it, cd into it, and run
python setup.py install