python pip

python pip 详解

Posted by leone on 2018-04-22

python pip

pip 介绍

pip是一个以Python计算机程序语言写成的软件包管理系统,他可以安装和管理软件包,另外不少的软件包也可以在“Python软件包索引”(英语:Python Package Index,简称PyPI)。

pip的其中一个主要特点就是其方便使用的命令行接口,这让用户可以透过以下的一句文字命令来轻易地安装Python软件包:

pip install package-name

pip使用

pip安装python中的模块,由于python需要安装相当多的模块,可以使用pip,pip依赖于pip仓库,默认为:https://pypi.org/

Python 环境安装好之后pip默认已经安装成功一般情况下无需安装(但也可以手动安装)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 安装某个包
$ pip install package_name

# 查看某个已安装包
$ pip show --files package_name

# 检查哪些包需要更新
$ pip list --outdated

# 升级包
$ pip install --upgrade package_name

# 卸载包
$ pip uninstall package_name

# 使用pip –help命令可以查看pip帮助手册
$ pip --help

# pip --help
[root@localhost ~]# pip3 --help

Usage:
pip3 <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.
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 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,
(a)bort).
--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.
--no-color Suppress colored output
[root@localhost ~]#

#
$

#
$