Python 的 Keras 无法使用 Anaconda 安装
Keras for Python can't be installed using Anaconda
我想在 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 (see https://anaconda.org/conda-forge/keras)
and I tried to install the packages by using the GUI of Anaconda. Both yielded the same error message.
问题似乎出在 conda
而不是 keras
,参见 here。使用 pip
而不是 conda
可能会解决您的问题。
但是,我不鼓励使用 keras
,因为现在推荐使用 tf.keras
来使用 Keras,请参阅 here:
Keras 2.3.0 is the first release of multi-backend Keras that supports
TensorFlow 2.0. It maintains compatibility with TensorFlow 1.14, 1.13,
as well as Theano and CNTK.
This release brings the API in sync with the tf.keras API as of
TensorFlow 2.0. However note that it does not support most TensorFlow
2.0 features, in particular eager execution. If you need these features, use tf.keras.
This is also the last major release of multi-backend Keras. Going
forward, we recommend that users consider switching their Keras code
to tf.keras in TensorFlow 2.0.
因此,如果 conda install tensorflow
适合您,只需在您的代码中将任何出现的 keras
替换为 tf.keras
。这样就不用单独安装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 (see https://anaconda.org/conda-forge/keras) and I tried to install the packages by using the GUI of Anaconda. Both yielded the same error message.
问题似乎出在 conda
而不是 keras
,参见 here。使用 pip
而不是 conda
可能会解决您的问题。
但是,我不鼓励使用 keras
,因为现在推荐使用 tf.keras
来使用 Keras,请参阅 here:
Keras 2.3.0 is the first release of multi-backend Keras that supports TensorFlow 2.0. It maintains compatibility with TensorFlow 1.14, 1.13, as well as Theano and CNTK.
This release brings the API in sync with the tf.keras API as of TensorFlow 2.0. However note that it does not support most TensorFlow 2.0 features, in particular eager execution. If you need these features, use tf.keras.
This is also the last major release of multi-backend Keras. Going forward, we recommend that users consider switching their Keras code to tf.keras in TensorFlow 2.0.
因此,如果 conda install tensorflow
适合您,只需在您的代码中将任何出现的 keras
替换为 tf.keras
。这样就不用单独安装keras