Python开发之开发之pip安装及使用方法详解安装及使用方法详解
pip是什么是什么
其实,pip就是 Python标准库(The Python Standard Library)中的一个包,这个包比较特殊,用它可以来管理Python标准库
(The Python Standard Library)中其他的包。pip支持从PyPI(https://pypi.org/ ),版本控制,本地项目以及直接从分发文
件进行安装。pip是一个命令行程序。 安装pip后,会向系统添加一个pip命令,该命令可以从命令提示符运行。
目前,pip 是The Python Packaging Authority (PyPA) 推荐的 Python 包管理工具!
The Python Packaging Authority (PyPA) is a working group that maintains many of the relevant projects in Python
packaging.
pip安装安装
从 Python 2 版本 >=2.7.9 或 Python 3 版本 >=3.4 开始,官网的安装包中已经自带了 pip,在安装时用户可以直接选择安装。
或者如果使用由 virtualenv 或者 pyvenv 创建的 Virtual Environment,那么 pip 也是被默认安装的。
如果没有在安装python时候,选择上”安装pip”选项,那么也可以从本地安装。例如,直接使用get-pip.py进行安装。
首先从官网下载get-pip.py;
然后直接运行python get-pip.py即可;
pip使用使用
安装后,在命令行中键入:pip+ 回车,就会出现如下使用说明:
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.
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
pip命令组合比较灵活,下面重点介绍几个。
install
命令行直接键入pip install + 回车,则 出现如下提示:ERROR: You must give at least one requirement to install (see “pip