【问题记录】pip 安装报错 Failed to establish a new connection

问题:

在安装 mmcv 的时候使用 pip install mmcv 报错如下:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7fee6df12f60>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/mmcv/

在这里插入图片描述

解决方案:

输入如下代码:

sudo echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null
Collecting mmcv
  Downloading mmcv-1.6.1.tar.gz (563 kB)
     |████████████████████████████████| 563 kB 986 kB/s
Collecting addict
  Downloading addict-2.4.0-py3-none-any.whl (3.8 kB)
Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from mmcv) (1.19.5)
Requirement already satisfied: packaging in /usr/local/lib/python3.8/dist-packages (from mmcv) (20.9)
Requirement already satisfied: Pillow in /usr/local/lib/python3.8/dist-packages (from mmcv) (8.1.2)
Requirement already satisfied: pyyaml in /usr/local/lib/python3.8/dist-packages (from mmcv) (5.4.1)
Collecting yapf
  Downloading yapf-0.32.0-py2.py3-none-any.whl (190 kB)
     |████████████████████████████████| 190 kB 31.8 MB/s
Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.8/dist-packages (from packaging->mmcv) (2.4.7)
Building wheels for collected packages: mmcv
  Building wheel for mmcv (setup.py) ... done
  Created wheel for mmcv: filename=mmcv-1.6.1-py2.py3-none-any.whl size=860277 sha256=4f25550e01acc52694ddc0d12451bd57a9b2dd7f78f3cc679e54687323517eeb
  Stored in directory: /root/.cache/pip/wheels/e3/ac/32/75552e05d1964b2123f074fe3e87c890e9ac83bc2d2c5b59d6
Successfully built mmcv
Installing collected packages: yapf, addict, mmcv
Successfully installed addict-2.4.0 mmcv-1.6.1 yapf-0.32.0
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

呆呆的猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值