pip下使用代理安装包
一句话代码
pip install --proxy x.x.x.x:8080 requsets
pip install --proxy x.x.x.x:8080 --upgrade pip
帮助文件
pip -h
--proxy Specify a proxy in the form
[user:passwd@]proxy.server:port.
一句话代码
pip install --proxy x.x.x.x:8080 requsets
pip install --proxy x.x.x.x:8080 --upgrade pip
帮助文件
pip -h
--proxy Specify a proxy in the form
[user:passwd@]proxy.server:port.
升级的时候注意权限
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade -i https://pypi.douban.com/simple/ " + dist.project_name, shell=True)