代理配置(pip,yum,npm)

pip代理配置

1、永久设置

/etc/profile:

vim /etc/profile:
    export http_proxy='http://代理服务器IP:端口号'
    export https_proxy='http://代理服务器IP:端口号'
source /etc/profile

2、临时的修改环境变量

export http_proxy='http://代理服务器IP:端口号 
export https_proxy='http://代理服务器IP:端口号'

3、单次设置

pip install -r requirements.txt --proxy=代理服务器IP:端口号

注释:顺便说一下pip 源配置

cd ~

看看有没有.pip 文件夹,没有可以新建

vi ~/.pip.pip.conf

# add this 
[global]
trusted-host = xxxxxxxxx
index = http://xxxxxxxxx
index-url = http://xxxxxxxxx

记住host要在/etc/hosts里有对应的IP,否则不认识你的host,可以ping一下

npm代理配置

 

你可能感兴趣的:(Linux)