- 环境CentOS conda+Python3.6
最近客户提供了一个新CentOS系统让部署一个环境。费了好大劲才找到解决办法。
记录为证
参照:https://blog.csdn.net/weixin_44984664/article/details/108028704
- wget 下载文件时
提示:没有到主机的路由
[root@localhost ~]# wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh
–2021-01-21 20:38:34-- https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh
正在连接 192.168.1.222:8099… 失败:没有到主机的路由。
[root@localhost ~]#
- pip安装包时
提示:没有到主机的路由
[root@localhost ~]# pip install tensorflow
Collecting tensorflow
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc5b976f630>: Failed to establish a new connection: [Errno 113] 没有到主机的路由’,))’: /simple/tensorflow/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc5b976f780>: Failed to establish a new connection: [Errno 113] 没有到主机的路由’,))’: /simple/tensorflow/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc5b976f358>: Failed to establish a new connection: [Errno 113] 没有到主机的路由’,))’: /simple/tensorflow/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc5b976f5f8>: Failed to establish a new connection: [Errno 113] 没有到主机的路由’,))’: /simple/tensorflow/
^COperation cancelled by user
原因:设置了代理,代理没有权限。
解决方案:把代理关掉即可
- 查看代理:
env|grep -i proxy
http_proxy=192.168.1.222:8099
https_proxy=192.168.1.222:8099
- 临时窗口关掉代理:
(关闭终端后元代理仍然存在)代理:
export http_proxy=""
export https_proxy=""
- 设置代理:
export http_proxy=“192.168.1.222:8099”
export https_proxy=“192.168.1.222:8099”
- 取消代理:
unset http_proxy
unset https_proxy