菜鸟笔记
提升您的技术认知

pip install 参数完全解析

参考:https://pip.pypa.io/en/stable/reference/pip_install/

pip install 的一些命令

pip install -u 是升级安装
pip install --user 是安装在本用户的目录下
# 这样会将Python 程序包安装到 $HOME/.local 路径下,其中包含三个字文件夹:bin,lib 和 share。

pip install -r <file>
Install from the given requirements file. This option can be used multiple times. 从给定的需求文件安装。 此选项可以多次使用。(可以嵌套使用)

pip install -i <url> or pip install --index-url <url>
Python软件包索引的基本URL(默认为https://pypi.org/simple)。 这应指向符合PEP 503(简单存储库API)的存储库或以相同格式布置的本地目录。(软件包存放的URL地址,需要符合PEP 503协议)

pip install --extra-index-url <url>

--trusted-host <hostname> 
比如:--trusted-host	mirrors.aliyun.com,将某个host或者host:port标记为可信赖的,即使它没有有效的HTTPS或任何HTTPS。



pip install --pre 
Include pre-release and development versions. By default, pip only finds stable versions. 查找预发行和正在开发的版本,默认情况下,pip仅查找稳定版本。

# 一个使用例子
pip install --pre xxxx --user -i http://pypi.xxx.cc/hobot-local/simple --extra-index-url=http://mirrors.aliyun.com/pypi/simple/ --trusted-host pypi.xxx.cc --trusted-host mirrors.aliyun.com