Anaconda有不同的Tensorflow包,有GPU支持和没有GPU支持
特别是,要使用GPU安装Tensorflow,您应该运行:
conda install tensorflow-gpu
对于非GPU版本,您应安装:
conda install tensorflow
通过检查已安装软件包的版本,conda将安装Tensorflow 2.1版
但到今天为止,Tensorflow的最新版本是2.3。此外,正如在Tensorflow officla documentation中所看到的,最新版本可以安装在
pip install tensorflow
文档中说这个包对于Tensorflow的CPU和GPU版本都很好。此外,文档中还指出,CPU和GPU的软件包在“1.15及更高版本”中有所不同
为什么Anaconda在两个不同的包中提供2.1,因为任何版本的包都应该相同>;1.15?
我应该安装哪一个,pip版本还是conda版本?Anaconda blog中的一篇文章指出,与conda一起提供的版本更快,但这篇文章是旧的(2018),并且引用了Tensorflow的旧版本(1.10)
那只是因为你(可能?)在windows上。正如您所看到的,here
tensorflow
作为2.3从conda
默认通道中可用,但目前仅在linux上可用你的网站上也说明了原因linked(我的重点):
简而言之:Anaconda团队正在针对intel mkl库创建自定义tf版本,以加快CPU上的计算速度。早些时候在同一个网站上,他们还提到他们为不同的cuda版本创建版本
tensorflow-gpu
软件包只是一个元软件包,也就是说,它只用于安装具有不同依赖项的不同版本的tensorflow
(也使您能够安装不同的cuda版本)。官方版本只允许combinations的tensorflow版本和cuda在阅读上述文章时,这种加速与针对英特尔mkl库的构建有关,后者可以加速CPU上的计算。考虑到您的设置,在使用
conda
时只能安装tensorflow
2.1,您需要问问自己是否依赖最新的tensorflow
版本,以及是否不需要加速的cpu代码。使用pip
安装最新的tensorflow通常没有问题。只需确保您为上述tensorflow版本创建了一个新环境,并且仅在该环境中使用pip
安装/更新tensorflow或其任何依赖项即可。有general advice到不混合conda
和pip
安装太多,因为一个安装可能会破坏另一个安装(因为它们使用不同的方法来解决依赖关系),但使用单独的env时应该很好如果您使用的是Anaconda,则可以使用conda安装tensorflow。对于cpu版本,输入
如果您使用的是Windows,它将安装版本2.1.0、cuda工具包版本10.1.243和cudnn版本7.6.5。注意:conda只能在Windows操作系统上安装tensorflow版本2.1.0。如果需要tensorflow 2.2.0或2.3.0,请在安装2.1后使用pip使用pip安装它。cuda工具包和cudnn使用2.2和2.3版。还有一件事。使用python3.7而不是3.8。显然,当你用conda安装tensorflow时,它不能与3.8兼容。 如果您使用pip安装tensorflow 2.1或更高版本,它包括cpu和gpu版本,但是您必须通过手动过程来安装Cuda Toolkit和cudnn。这包括从NVIDIA下载文件。您还必须更改PATH环境变量
相关问题 更多 >
编程相关推荐