1. 使用 apt 安裝:
$ sudo apt-get install python-pip
截止本文落筆,apt 安裝 pip 版本為 1.0,但 pip 最新發(fā)行版本為 1.5.6
$ pip --versionpip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)
pip 1.0 特性:
$ pip -hUsage: pip COMMAND [OPTIONS]Options: --version show program's version number and exit -h, --help Show help -E DIR, --environment=DIR virtualenv environment to run pip in (either give the interpreter or the environment base directory) -s, --enable-site-packages Include site-packages in virtualenv if one is to be created. Ignored if --environment is not used or the virtualenv already exists. -v, --verbose Give more output -q, --quiet Give less output --log=FILENAME Log file where a complete (maximum verbosity) record will be kept --proxy=PROXY Specify a proxy in the form user:passwd@proxy.server:port. Note that the user:password@ is optional and required only if you are behind an authenticated proxy. If you provide user@proxy.server:port then you will be prompted for a password. --timeout=SECONDS, --default-timeout=SECONDS Set the socket timeout (default 15 seconds)Commands available: bundle: Create pybundles (archives containing multiple packages) freeze: Output all currently installed packages (exact versions) to stdout help: Show available commands install: Install packages search: Search PyPI uninstall: Uninstall packages unzip: Unzip individual packages zip: Zip individual packages
2. 使用 get-pip.py 安裝:
$ wget https://bootstrap.pypa.io/get-pip.py...$ sudo python get-pip.py...
3. 升級
# On Linux or OS X$ sudo pip install -U pip# On Windows$ python -m pip install -U pip
1. 安裝 package:
$ pip install SomePackage # latest version$ pip install SomePackage==1.0.4 # specific version$ pip install 'SomePackage>=1.0.4' # minimum version
1.1. 升級已安裝包:
$ sudo pip install -U chardet
2. 卸載 package:
$ sudo pip uninstall bottle
3. 搜索 package:
$ pip search bottle
4. 列出已安裝 package:
$ pip list
4.1. 列出過期 package:
$ pip list --outdated
5. 顯示已安裝包詳細(xì)信息
$ pip show gevent---Name: geventVersion: 1.0.1Location: /usr/local/lib/python2.7/dist-packagesRequires: greenlet