问题摘要
内网服务器不能访问外网,通过内网服务当做代理机,访问和互联网进行环境管理。命令行窗口设置好http/https代理服务器,在运行conda 命令时报错:botocore.exceptions.ProxyConnectionError: Failed to connect to proxy URL: “http://hostname:port”。
解决
通常情况下没有必要配置代理服务器,在网络访问不便时,或者公司对网络有安全要求,通过代理服务器访问时配置:
-
修改conda配置文件
.condarc
文件:命令行输入vim ~/.condarc
回车,将如下修改后的配置填进去。:wq
保存退出。 -
需要重启conda,断开shell 再次打开,即可!
# 原来的默认conda 配置文件,如果你添加源了可能不一样。
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true
#修改后的配置,-->加上你的代理服务proxy_servers
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: true
proxy_servers:
http: http://10.8.38.10:808 # 修改
https: https://10.8.38.10:808 # 修改
ssl_verify: false
!!!注意把http:和https:后面的链接换成你的代理链接和端口号。
详细配置问题,请参阅《conda官方文档》。