如何安装 Tensorflow 2.4.0?

How do I install Tensorflow 2.4.0?

菜鸟问题。谢谢你的包容

我的电脑上安装了 Tensorflow 2.4.1,但我需要 2.4.0 版本才能与特定项目兼容。

我尝试了以下但没有成功:

conda install tensorflow==2.4.0
conda install -c conda-forge tensorflow==2.4.0

它会这样做一段时间,直到 jupyter notebook 告诉我它找不到我需要的东西

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
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:

  - tensorflow==2.4.0 -> python[version='3.6.*|3.7.*|3.8.*']
  - tensorflow==2.4.0 -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']

Your python: python=3.9

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.

请帮忙。

创建基于tensorflow 2.4.0的环境:

conda create --name tf_2.4.0 tensorflow=2.4.0

然后激活它:

conda activate tf_2.4.0

这将使用 tensorflow 2.4.0 作为依赖项安装您需要的所有内容。例如,您应该得到 python-3.8.12 !

根据 tensorflow 官方网站 - https://www.tensorflow.org/install/pip#:~:text=System%20requirements,-Python%203.7%E2%80%933.10&text=Python%203.9%20support%20requires%20TensorFlow,requires%20TensorFlow%202.2%20or%20later.

TF 2.4 不被python 3.9 支持,所以你需要在conda 里面安装不同版本的python 最好是3.8,然后你才能安装TF 2.4