如何安装带有gpu支持的Keras? [英] How to install Keras with gpu support?
问题描述
我使用以下命令安装了Tensorflow for GPU:pip install tensorflow-gpu
但是,当我对 Keras pip install keras-gpu
尝试相同的操作时,我却遇到了一个错误:找不到满足要求的版本.
I installed Tensorflow for GPU using: pip install tensorflow-gpu
But when I tried the same for Keras pip install keras-gpu
, it pulled me an error: could not find the version that satisfies the requirements.
推荐答案
没有没有任何keras-gpu
软件包[ UPDATE :现在有,请参阅下面的其他答案]; Keras是围绕某些后端(包括Tensorflow)的包装,这些后端可能具有不同的版本,例如tensorflow
和tensorflow-gpu
.但这不适用于Keras本身,应与
There is not any keras-gpu
package [UPDATE: now there is, see other answer below]; Keras is a wrapper around some backends, including Tensorflow, and these backends may come in different versions, such as tensorflow
and tensorflow-gpu
. But this does not hold for Keras itself, which should be installed simply with
pip install keras
与使用的后端无关(请参见 PyPi文档).
independently of whatever backend is used (see the PyPi docs).
此外,由于您也将问题标记为anaconda
,因此,通常不建议将软件包管理器(即pip
与conda
)混合使用,这样可能会更好来自 Anaconda云和
Additionally, and since you have tagged the question as anaconda
, too, be informed that it is generally not advisable to mix your package managers (i.e pip
with conda
), and you may be better off installing Keras from the Anaconda cloud with
conda install -c conda-forge keras
最后,您可能还想知道Tensorflow的最新版本将Keras作为子包包含在内,因此您可以在不进行任何其他安装的情况下使用它.参见 https://www.tensorflow.org/guide/keras
Finally, you may be also interested to know that recent versions of Tensorflow include Keras as a subpackage, so you can use it without any additional installation; see https://www.tensorflow.org/guide/keras
要从 Anaconda云安装tensorflow-gpu
,您应该使用
conda install -c anaconda tensorflow-gpu
在安装Keras之前.确保已经在不同的虚拟环境中执行此操作,或者在卸载了其他版本(例如,安装了pip
的版本)之后执行此操作,因为存在
before installing Keras. Be sure you do it in a different virtual environment, or after having uninstalled other versions (i.e. pip
-installed ones), as there have been reported problems otherwise.
这篇关于如何安装带有gpu支持的Keras?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!