如何安装支持 gpu 的 Keras? [英] How to install Keras with gpu support?

查看:31
本文介绍了如何安装支持 gpu 的 Keras?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为 GPU 安装了 Tensorflow: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,这些后端可能有不同的版本,例如 tensorflowtensorflow-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,请注意通常不建议将包管理器(即 pipconda),你最好从 Anaconda cloud 安装 Keras

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 cloud 安装 tensorflow-gpu,您应该使用

For installing tensorflow-gpu from Anaconda cloud, you should use

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆