pip

Python pip

Posted by Randle on December 4, 2019

1 配置源

1.1 配置文件

1
2
3
4
5
[global] 
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
# trusted-host 此参数是为了避免麻烦,否则使用的时候可能会提示不受信任
trusted-host = https://pypi.tuna.tsinghua.edu.cn  

1.2 临时配置

1
2
3
pip install -i http://pypi.douban.com/simple/ numpy
#此参数“--trusted-host”表示信任,如果上一个提示不受信任,就使用这个
pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com  

1.3 国内镜像站

  • 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple
  • 阿里云:http://mirrors.aliyun.com/pypi/simple/
  • 豆瓣:http://pypi.douban.com/simple/

2 安装配置

2.1 安装位置

配置 pip 安装包的时候,安装在用户目录。

2.1.1 配置文件

~/.pip/pip.conf

1
2
[install]
install-option=--prefix=~/.local

2.1.2 临时

1
pip install --user USER_NAME

参考资料