python - 无法使用 Anaconda 安装 Python 的 Keras
问题描述
我想在 Python ( https://keras.io/ ) 中安装用于机器学习的 libaray Keras。我使用 Anaconda(作为管理员)并尝试了以下命令。
(base) C:\Users\wi9632>conda install keras
这是带有错误消息的输出:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- keras -> python[version='>=3.5,<3.6.0a0|>=3.6,<3.7.0a0']
Your python: python=3.8.5
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
你能告诉我为了安装 Keras 我必须做什么吗?如果我理解正确,我的 Python 环境的版本是新的吗?我会很感激每一条评论。
没有人知道我能做什么吗?我会很高兴的。
更新:我使用以下命令进行了尝试:
conda install -c conda-forge keras (请参阅https://anaconda.org/conda-forge/keras),我尝试使用 Anaconda 的 GUI 安装软件包。两者都产生了相同的错误消息。
解决方案
问题似乎在于 withconda
而不是 with keras
,请参见此处。使用pip
代替conda
可能会解决您的问题。
但是,我不鼓励使用keras
,因为现在使用tf.keras
是使用 Keras 的推荐方式,请参见此处:
Keras 2.3.0 是支持 TensorFlow 2.0 的多后端 Keras 的第一个版本。它保持与 TensorFlow 1.14、1.13 以及 Theano 和 CNTK 的兼容性。
此版本使 API 与 TensorFlow 2.0 中的 tf.keras API 保持同步。但是请注意,它不支持大多数 TensorFlow 2.0 功能,尤其是急切执行。如果您需要这些功能,请使用 tf.keras。
这也是多后端 Keras 的最后一个主要版本。展望未来,我们建议用户考虑将他们的 Keras 代码切换到 TensorFlow 2.0 中的 tf.keras。
因此,如果对您有用,只需在您的代码中conda install tensorflow
替换任何外观。这样就不需要单独安装了。keras
tf.keras
keras
推荐阅读
- stata - 如何以编程方式创建宏的名称并将其用作宏?
- python - 使用 Python 中的第二列按字母顺序排列文本文件
- ios - 编辑 Swift 4 时 TextField 消失
- python - Python Scrapy - 无法登录网站
- angularjs - AngularJs ng-repeat 有条件地按限制过滤
- reactjs - 如何在特定时间后取消 axios 调用
- javascript - Javascript 中奖百分比算法
- node.js - Nestjs 存储库模式配置挑战
- javascript - 将类添加到父跨度元素jquery
- python - 使用熊猫在相同的日子里找到平均值