r - 在 R 中安装 keras:警告:pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用
问题描述
我是 keras 的新手,并试图使用本指南在运行 Windows 10 的计算机上在 R 中安装 keras 和 tensorflow,但标题中出现错误:
install_keras()
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
All requested packages already installed.
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tensorflow/
Could not fetch URL https://pypi.org/simple/tensorflow/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/tensorflow/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement tensorflow==2.6.* (from versions: none)
ERROR: No matching distribution found for tensorflow==2.6.*
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Error: Error installing package(s): "\"tensorflow==2.6.*\"", "\"tensorflow-hub\"", "\"scipy\"", "\"requests\"", "\"Pillow\"", "\"h5py\"", "\"pandas\""
由于这个问题,我尝试安装 OpenSSL,还尝试按照此处所述复制 dll ,但没有任何效果。
有什么建议么?
解决方案
所以,我自己找到了解决方案。我做了:
library(reticulate)
install_miniconda(force = TRUE)
在 Windows 的命令提示符下,我做了:
conda activate r-reticulate
install keras
...一切正常!
即使我没有激活 r-reticulate 环境,现在似乎也可以工作。
推荐阅读
- javascript - 尽管正在登录控制台,但响应标头未显示在浏览器中 - Cloudflare Workers
- javascript - Javascript重定向在应用程序andriod浏览器中的facebook上不起作用?
- wordpress - 如何在 Woocommerce 管理员自定义订单过滤器中添加子订单按钮?
- canvas - P5.js:使用flexbox时如何防止文本被压扁
- python - 停止文件验证的 Pythonic 方法
- python - 使用 requests-html 从 Python 网页中提取特定元素
- git - 多个 github 存储库的 SSH 密钥
- html - html中的网站图标问题
- mysql - 通过 Spoon 连接 MySQL
- android - 如何绑定服务?