Python之pip包管理

原创
01/15 10:26
阅读数 38

简介

pip is the package installer for Python.
You can use pip to install packages from the Python Package Index and other indexes.

官网说明:pip是Python包管理工具,主要用于包的查找、下载、安装、卸载的功能。 当前版本:V19.3.1

安装

本人主要使用MacOX、Centos7系统,关于安装,这里介绍2种方式。

curl

# 下载安装脚本
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

# 运行安装脚本
sudo python get-pip.py

easy_install

easy_install pip

参数说明

[root@bash ~]# pip --help

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 3 times).
  --timeout <sec>             Set the socket timeout (default 90.0 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bo