pip添加代理

不能访问外网的服务器需要设置pip代理,其中代理为nexus中的pip库

命令行设置代理

PIP_HOST="nexus.goldwind.com.cn"
PIP_PROXY_URL="http://$PIP_HOST/repository/pypi-group-proxys"
pip install -i $PIP_PROXY_URL -U --trusted-host $PIP_HOST pip
pip config set global.index $PIP_PROXY_URL/pypi
pip config set global.index-url $PIP_PROXY_URL/simple
pip config set global.trusted-host $PIP_HOST
pip config set global.format freeze

后在~/.config/pip/pip.conf 自动生成文件

[global]
index = http://nexus.goldwind.com.cn/repository/pypi-group-proxys/pypi
index-url = http://nexus.goldwind.com.cn/repository/pypi-group-proxys/simple
trusted-host = nexus.goldwind.com.cn
format = freeze

 

posted @ 2024-01-16 10:52  潇潇暮鱼鱼  阅读(46)  评论(0)    收藏  举报