码迷,mamicode.com
首页 > 编程语言 > 详细

[Python] pip 简明指南

时间:2014-09-01 10:42:02      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   使用   ar   for   

安装

  1. 使用 apt 安装:

$ sudo apt-get install python-pip

 

  截止本文落笔,apt 安装 pip 版本为 1.0,但 pip 最新发行版本为 1.5.6

$ pip --version
pip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)

 

  pip 1.0 特性:

bubuko.com,布布扣
$ pip -h
Usage: pip COMMAND [OPTIONS]

Options:
  --version             show programs 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
View Code

 

  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. 显示已安装包详细信息

$ pip show gevent
---
Name: gevent
Version: 1.0.1
Location: /usr/local/lib/python2.7/dist-packages
Requires: greenlet

 

[Python] pip 简明指南

标签:style   blog   http   color   os   io   使用   ar   for   

原文地址:http://www.cnblogs.com/ifantastic/p/3948454.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!