您的位置:首页 > 运维架构 > Linux

Linux 包管理工具 pip 使用详解

2015-08-20 17:12 661 查看
1. pip install 安装软件

[example@admin ~]$ pip install somepackage
[...]
Successfully installed somepackage

参数:
--upgrade 升级某包


2. pip show 查看已安装的软件(以matplotlib为例子)

[example@admin ~]$ pip show matplotlib
---
Metadata-Version: 1.1
Name: matplotlib
Version: 1.4.3
Summary: Python plotting package
Home-page: http://matplotlib.org Author: John D. Hunter, Michael Droettboom
Author-email: mdroe@stsci.edu
License: BSD
Location: /usr/local/lib/python3.4/site-packages
Requires: numpy, six, python-dateutil, pytz, pyparsing, nose, nose

参数:
--files 列出文件地址


3. pip list 列出现有软件

[example@admin ~]$ pip list
matplotlib (1.4.3)
nose (1.3.7)
numpy (1.9.2)
[...]
Name (Version)

参数:
--outdated 需要更新的软件


4. pip uninstall 卸载某软件

[example@admin ~] pip uninstall somepackage
Uninstalling somepackage:
/my/env/lib/pythonx.x/site-packages/somepackage
Proceed (y/n)? y
Successfully uninstalled somepackage


5. pip --help 帮助

[example@admin ~] pip --help

Usage:
pip <command> [options]

Commands:
install                     Install packages.
uninstall                   Uninstall packages.
freeze                      Output installed packages in requirements format.
list                        List installed packages.
show                        Show information about installed packages.
search                      Search PyPI for packages.
wheel                       Build wheels from your requirements.
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.
--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 5 times).
--timeout <sec>             Set the socket timeout (default 15 seconds).
--exists-action <action>    Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup.
--trusted-host <hostname>   Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path>               Path to alternate CA bundle.
--client-cert <path>        Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir>           Store the cache data in <dir>.
--no-cache-dir              Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.


参考资料:linux中pip安装步骤和使用详解
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: