解决CondaHTTPError: HTTP 000 CONNECTION FAILED for url & SSLError(MaxRetryError('HTTPSConnectionPool(h

anaconda创建新环境问题

问题描述

  • 实验环境:Windows10;Anaconda3

安装完anaconda后使用命令 conda create -n test3.7 python=3.7 准备新建一个虚拟环境,出现错误,具体如下所示:

C:\Users\dell>conda create -n test3.7 python=3.7
WARNING: The conda.compat module is deprecated and will be removed in a future release.
Collecting package metadata: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/repodata.json.bz2>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/main/win-64/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))

分析问题

看错误说的大概是:链接网络出现错误。上网搜索给的建议基本都是更换源,如:

问题:输入conda upgrade --all显示错误CondaHTTPError: HTTP 000 CONNECTION FAILED for url
解决:直截了当——查询.condarc文件,把内容改为如下所示内容,使用清华大学镜像。
原因:Anaconda Navigator主服务器访问困难

笔者试了一下,未能解决问题。

问题解决

因为我是新电脑第一次安装,而之前旧电脑上是可以通过conda create -n命令创建。搞得一头雾水,为什么呢?难道是版本问题?还是现在的版本要访问的网络源被墙了?一顿猜测实践后,终于解决。没有任何技巧,纯经验。

首先打开安装好的anaconda navigator,初始化后在图形界面是可以创建的。

在这里插入图片描述

之后我们便可在命令行界面查看已经创建好的环境:

C:\Users\dell>conda env list
WARNING: The conda.compat module is deprecated and will be removed in a future release.
WARNING: The conda.compat module is deprecated and will be removed in a future release.
# conda environments:
#
base                  *  C:\Users\dell\Anaconda3
test3.7                  C:\Users\dell\Anaconda3\envs\test3.7

安装自己所需要的包:

(test3.7) C:\Users\dell>pip list
Package      Version
------------ --------
certifi      2019.3.9
pip          19.1.1
setuptools   41.0.1
wheel        0.33.4
wincertstore 0.2

(test3.7) C:\Users\dell>pip install celery
Collecting celery
  Using cached https://files.pythonhosted.org/packages/5c/a1/a3dd9d8bfa09156ec2cba37f90accf35c0f4ecc3980d96cb4fb99e56504b/celery-4.3.0-py2.py3-none-any.whl
Collecting kombu<5.0,>=4.4.0 (from celery)
  Using cached https://files.pythonhosted.org/packages/e7/b1/19cc103250276cf4319f8e4246afb307886ce676d5c06dab0680c6d3e3f9/kombu-4.6.0-py2.py3-none-any.whl
Collecting vine>=1.3.0 (from celery)
  Using cached https://files.pythonhosted.org/packages/7f/60/82c03047396126c8331ceb64da1dc52d4f1317209f32e8fe286d0c07365a/vine-1.3.0-py2.py3-none-any.whl
Collecting billiard<4.0,>=3.6.0 (from celery)
Collecting pytz>dev (from celery)
  Downloading https://files.pythonhosted.org/packages/3d/73/fe30c2daaaa0713420d0382b16fbb761409f532c56bdcc514bf7b6262bb6/pytz-2019.1-py2.py3-none-any.whl (510kB)
     |████████████████████████████████| 512kB 297kB/s
Collecting amqp<3.0,>=2.5.0 (from kombu<5.0,>=4.4.0->celery)
  Using cached https://files.pythonhosted.org/packages/45/91/877ea2d1c3234dbb32e818d281615232468ff8a4a783a8fc264862b9f77b/amqp-2.5.0-py2.py3-none-any.whl
Installing collected packages: vine, amqp, kombu, billiard, pytz, celery
Successfully installed amqp-2.5.0 billiard-3.6.0.0 celery-4.3.0 kombu-4.6.0 pytz-2019.1 vine-1.3.0

没有任何技巧,难度,纯经验一步步试出来的,兴许可以帮助我们节省好多时间呢!

从一名不羁的码农开始,欢迎关注我的微信公众号
在这里插入图片描述

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值