简体   繁体   English

如何在 anaconda 上安装 tensorflow 2.4>?

[英]How do I install tensorflow 2.4> on anaconda?

The conda install is only for tf 2.2.0 as there doesn't seem to be a cudnn 8.0 on anaconda. conda 安装仅适用于 tf 2.2.0,因为 anaconda 上似乎没有 cudnn 8.0。

https://anaconda.org/anaconda/tensorflow-gpu https://anaconda.org/anaconda/tensorflow-gpu

Does anyone know of a method of getting tf 2.4>= running within an anaconda environment?有谁知道在 anaconda 环境中运行 tf 2.4>= 的方法?

Currently conda doesn't support installing tf>2.3.0目前 conda 不支持安装 tf>2.3.0

$ conda search tensorflow

...
tensorflow                     2.2.0 mkl_py37h6e9ce2d_0  pkgs/main           
tensorflow                     2.2.0 mkl_py38h6d3daf0_0  pkgs/main           
tensorflow                     2.3.0 eigen_py37h189e6a2_0  pkgs/main           
tensorflow                     2.3.0 eigen_py38h71ff20e_0  pkgs/main           
tensorflow                     2.3.0 mkl_py37h0481017_0  pkgs/main           
tensorflow                     2.3.0 mkl_py38hd53216f_0  pkgs/main

BTW conda-gpu only supports up to 2.2.0 on conda顺便说一句conda-gpu在 conda 上最多仅支持2.2.0

As previous answers mentioned, you can install using pip install tensorflow while inside your conda environment.正如前面提到的答案,您可以在 conda 环境中使用pip install tensorflow

As of June 2021, you can use the standard conda installation for 2.4:截至 2021 年 6 月,您可以使用 2.4 的标准 conda 安装:

conda install tensorflow-gpu==2.4.1

As @theastronomist mentioned, it is good to use conda search tensorflow to find which versions are enabled.正如@theastronomist 提到的,最好使用conda search tensorflow来查找启用的版本。

As you mentioned the issue regarding CUDA also, I assume you want to upgrade tensorflow to match up the CUDA version with tf version.正如您提到的有关 CUDA 的问题,我假设您想升级 tensorflow 以匹配 CUDA 版本和 tf 版本。 I think your cuda version is 11.x.我认为您的 cuda 版本是 11.x。

There are two solutions, first, you can uninstall CUDA drivers, install 10.x and then use tf 2.3.解决方法有两种,一是可以卸载CUDA驱动,安装10.x再使用tf 2.3。 This will support gpu based tensor operations.这将支持基于 gpu 的张量操作。 In this case, you also have to downgrade tf in other environments (eg conda env in Pycharm IDE) because CUDA 10. will not supprot the downgraded tf versions.在这种情况下,您还必须在其他环境中降级 tf(例如 Pycharm IDE 中的 conda env),因为 CUDA 10. 将不支持降级的 tf 版本。

Or you can wait till anaconda supports tf 2.4.或者你可以等到 anaconda 支持 tf 2.4。 In that case, you dont need to change anything anywhere.在这种情况下,您无需在任何地方更改任何内容。 Just wait, install tf 2.4 in your conda env and use gpu with tensor operations.等一下,在你的 conda 环境中安装 tf 2.4 并使用 gpu 和张量操作。

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

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