简体   繁体   English

无法使用 Anaconda 安装 Python 版 Keras

[英]Keras for Python can't be installed using Anaconda

I would like to install the libaray Keras for machine learning in Python ( https://keras.io/ ).我想在 Python ( https://keras.io/ ) 中安装用于机器学习的 libaray Keras。 I use Anaconda (as an Administrator) and I tried the following command.我使用 Anaconda(作为管理员)并尝试了以下命令。

(base) C:\Users\wi9632>conda install keras

And here is the output with the error message:这是带有错误消息的输出:

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.

Can you tell me what I have to do in order to install Keras?你能告诉我安装 Keras 需要做什么吗? If I understand correctly, the version of my Python environment is to new?如果我理解正确,我的 Python 环境的版本是新的吗? I'd appreciate every comment.我会很感激每一条评论。

Does nobody have an idea what I can do?没有人知道我能做什么吗? I'd be quite happy about it.我会很高兴的。

Update: I tried it by using the command:更新:我使用以下命令进行了尝试:

conda install -c conda-forge keras (see https://anaconda.org/conda-forge/keras ) and I tried to install the packages by using the GUI of Anaconda. conda install -c conda-forge keras(参见https://anaconda.org/conda-forge/keras ),我尝试使用 Anaconda 的 GUI 安装软件包。 Both yielded the same error message.两者都产生了相同的错误消息。

The problem seems to be with conda rather than with keras , see here .问题似乎出在conda而不是keras ,请参见此处 Using pip instead of conda might resolve your problem.使用pip而不是conda可能会解决您的问题。

However, I'd discourage using keras anyway as now using tf.keras is the recommended way of working with Keras, see here :但是,我不鼓励使用keras ,因为现在使用tf.keras是使用tf.keras的推荐方式,请参见此处

Keras 2.3.0 is the first release of multi-backend Keras that supports TensorFlow 2.0. Keras 2.3.0 是第一个支持 TensorFlow 2.0 的多后端 Keras 版本。 It maintains compatibility with TensorFlow 1.14, 1.13, as well as Theano and CNTK.它保持与 TensorFlow 1.14、1.13 以及 Theano 和 CNTK 的兼容性。

This release brings the API in sync with the tf.keras API as of TensorFlow 2.0.此版本使 API 与 TensorFlow 2.0 的 tf.keras API 同步。 However note that it does not support most TensorFlow 2.0 features, in particular eager execution.但是请注意,它不支持大多数 TensorFlow 2.0 功能,尤其是 Eager Execution。 If you need these features, use tf.keras.如果您需要这些功能,请使用 tf.keras。

This is also the last major release of multi-backend Keras.这也是多后端 Keras 的最后一个主要版本。 Going forward, we recommend that users consider switching their Keras code to tf.keras in TensorFlow 2.0.展望未来,我们建议用户考虑将他们的 Keras 代码切换到 TensorFlow 2.0 中的 tf.keras。

So if conda install tensorflow works for you, just replace any appearance of keras with tf.keras in your code.因此,如果conda install tensorflow适合您,只需在您的代码中用tf.keras替换任何keras外观。 This way, there is no need to install keras separately.这样就不需要单独安装keras

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM