各大门户网站用什么做的,神东集团网站建设,长沙网站建设价格,企业网站 微博模块使用场景
正常网络情况下我们安装如果比较多的python包时#xff0c;会选择使用pip install -r requirements.txt -i https://pypi.douban.com/simple --trusted-hostpypi.douban.com这种国内的镜像来加快下载速度。
但是#xff0c;当这台被限制上网时#xff08;公司安全…使用场景
正常网络情况下我们安装如果比较多的python包时会选择使用pip install -r requirements.txt -i https://pypi.douban.com/simple --trusted-hostpypi.douban.com这种国内的镜像来加快下载速度。
但是当这台被限制上网时公司安全考虑就不能连外网了如果懒得一个个下载又懒得找运维开网络权限时可以选择设置代理来解决。
有三种常用方式
①永久设置
vim /etc/profileexport http_proxyhttp://代理服务器IP:端口号export https_proxyhttp://代理服务器IP:端口号
source /etc/profile
②临时设置重连后失效
也可以直接运行export http_proxyhttp://代理服务器IP:端口号
export https_proxyhttp://代理服务器IP:端口号
注意设置之后可能使用ping时还是无法连接外网但是pip时可以的因为ping的协议不一样不能使用这个代理
③单次设置
直接在pip时设置代理也是可以的
pip install -r requirements.txt --proxy代理服务器IP:端口号
例如
直接在pip时添加镜像即可pip install some-package -i 镜像地址
pip install pandas -i https://mirrors.aliyun.com/pypi/simple/
Windows系统可尝试如下方式
在C:\User\用户目录下新建pip文件夹然后在该文件夹下新建pip.ini文件。填写如下内容
[global]
index-url https://pypi.tuna.tsinghua.edu.cn/simple # 这里使用的是清华的镜像源
proxy http://XXXX.com:port
[install]
trusted-hostpypi.tuna.tsinghua.edu.cn
其他镜像
阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣 http://pypi.douban.com/simple/ 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/