pip或conda在线下载包时报错,无法下载,解决方案

Could not fetch URL https://pypi.org/simple/cdndrive/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/cdndrive/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)'))) - skipping

首先检查是否使用了代理软件,以前是可以直接开代理软件下载包的,现在不行了。

方案一:

所以关闭代理软件后在使用pip下载即可。

方案二:

将包文件下载到本地安装

pip install xxxxx.whl

方案三:

添加国内镜像源

升级pip到最新版
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip

设置永久清华源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

或者手动在pip所在目录下建立pip.ini文件,

例如D:\software\Anaconda3\Scripts目录下,建立文件后写入

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

Collecting package metadata (current_repodata.json): failed

UnavailableInvalidChannel: The channel is not accessible or is invalid.
  channel name: simple
  channel url: https://pypi.org/simple
  error code: 404

You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.

这是因为

https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

给了通知:

“根据 Anaconda 软件源上的说明,Anaconda 和 Miniconda 是 Anaconda, Inc. 的商标,任何未经授权的公开镜像都是不允许的。去年我们曾尝试与公司有关人员联系,但未能取得授权。

在没有上游授权的情况下,我们无法保证镜像的合法性与服务质量。因此我们决定,在取得授权之前无限期停止 Anaconda 镜像服务。即日起,我们将停止 Anaconda 的更新并隐藏镜像入口链接。一个月后,彻底关闭 Anaconda 镜像的文件下载。请现有用户尽快切换至官方下载地址,以免影响正常使用。

感谢您的理解与支持!

Update 1 on 2019-05-16: 上述镜像已经被移除”

也就是说,今天开始必须恢复官方源了

使用以下语句可以恢复到默认源。(不推荐,因为pypi有的,conda不一定有)

conda config --remove-key channels

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值