首页 > 解决方案 > 无法创建 conda 环境

问题描述

当我尝试创建环境时出现错误消息。我已经安装了 Anaconda3,它与 python3.7 一起安装,并且我已经在我的 window10 机器上设置了环境变量。通过使用 jupyter notebook,我从事机器学习方面的工作。但我无法在其上导入 tensorflow 库。所以我尝试安装一个环境。在我的 cmd 我试过

conda create -n tfp3.6 python=3.6
C:\>conda create -n tfp3.6 python=3.6
Solving environment: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/noarch/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/noarch/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))

这是我的环境变量 这是我的环境变量

请帮忙。提前致谢

标签: pythonanaconda

解决方案


这很可能是某些 Windows 系统上的 Python3.7 问题。

问题的根源隐藏在错误消息的尾部:"SSLError("Can\'t connect to HTTPS URL because the SSL module is not available.")"

在某些 Windows 上运行的 Python3.7 会出现此问题(我在 Windows 10 上遇到过此问题)。解决方法是:安装使用Python3.6

PS:就我而言,我发现了这个问题的非常棘手的表现:代码在 conda-shell 下成功运行,在 Jupyter-notebook 下成功运行,但无法从 cmd 运行,python.exe 取自 conda 安装或 conda-created环境。

为确保您遇到同样的问题,您可以在 cmd 中运行此行:

python -c "导入请求;响应 = requests.get(' https://stackoverflow.ru ', cert=False); print(response);"

(假设安装了 requests 包,例如通过 cmd 执行:“pip install requests”)

这个cmd执行应该在anaconda-shell下运行成功,但是在python3.7下运行失败


推荐阅读