什么是官方的“首选"?在系统范围内安装 pip 和 virtualenv 的方法? [英] What is the official "preferred" way to install pip and virtualenv systemwide?

查看:17
本文介绍了什么是官方的“首选"?在系统范围内安装 pip 和 virtualenv 的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是不是这个,人们似乎最常推荐的:

Is it this, which people seem to recommend most often:

$ sudo apt-get install python-setuptools
$ sudo easy_install pip
$ sudo pip install virtualenv

或者这个,我从 http://www.pip-installer.org/en/得到的最新/安装.html:

$ curl -O https://github.com/pypa/virtualenv/raw/master/virtualenv.py
$ python virtualenv.py my_new_env
$ . my_new_env/bin/activate
(my_new_env)$ pip install ...

或者完全不同的东西?

推荐答案

如果您可以安装最新的 Python(2.7.9 及更高版本),Pip 现在已与它捆绑在一起.请参阅:https://docs.python.org/2.7//installing/index.html
如果没有:
更新(来自发行说明):

If you can install the latest Python (2.7.9 and up) Pip is now bundled with it. See: https://docs.python.org/2.7//installing/index.html
If not :
Update (from the release notes):

从 v1.5.1 开始,pip 在运行 get-pip.py 之前不需要安装工具.此外,如果尚未安装 setuptools(或分发),get-pip.py 将为您安装 setuptools.

Beginning with v1.5.1, pip does not require setuptools prior to running get-pip.py. Additionally, if setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.

我现在运行常规:

curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python

以下是官方安装说明:http://pip.readthedocs.org/en/latest/installing.html#install-pip

2013 年 7 月 25 日
更改了 setuptools 安装的 URL.

EDIT 25-Jul-2013:
Changed URL for setuptools install.

编辑 2014 年 2 月 10 日:
删除了 setuptools 安装(感谢 @Ciantic)

EDIT 10-Feb-2014:
Removed setuptools install (thanks @Ciantic)

编辑 2014 年 6 月 26 日:
再次更新网址(感谢@LarsH)

EDIT 26-Jun-2014:
Updated URL again (thanks @LarsH)

编辑 2015 年 3 月 1 日:
Pip 现在与 Python 捆绑在一起

EDIT 1-Mar-2015:
Pip is now bundled with Python

这篇关于什么是官方的“首选"?在系统范围内安装 pip 和 virtualenv 的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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