成都网站建设设计

将想法与焦点和您一起共享

[Python]pip简明指南-创新互联

安装   1. 使用 apt 安装:[Python]pip简明指南
$ sudo apt-get install python-pip

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

10年积累的做网站、网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站制作后付款的网站建设流程,更有乌苏免费网站建设让你可以放心的选择与我们合作。
$ pip --version
pip1.0 from /usr/lib/python2.7/dist-packages (python 2.7)

pip 1.0 特性:

$ pip -h
Usage: pip COMMAND [OPTIONS]

Options:
--version             show program's version number and exit  -h, --help            Show help
-E DIR, --environment=DIR
                        virtualenv environment to run pipin (either give the
                        interpreter or the environment base directory)
-s, --enable-site-packages
                        Include site-packages in virtualenv if one is to be
                        created. Ignoredif --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 onlyif you
                        are behind an authenticated proxy.  If you provide
                        user@proxy.server:portthen you will be prompted for a
                        password.
--timeout=SECONDS, --default-timeout=SECONDS
                        Set the socket timeout (default15 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
$ pipinstall SomePackage==1.0.4      # specific version
$ pipinstall '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
问题

1. 出现以下错误提示很可能是由于 SSL 未通过验证:

Cannot fetch index base URL http://pypi.python.org/simple/

解决方法:检查系统时间是否正确,调整系统时间参考《设置系统时区》。


标题名称:[Python]pip简明指南-创新互联
当前网址:http://chengdu.cdxwcx.cn/article/eojpi.html