【问题标题】:How do I install Tensorflow 2.4.0?如何安装 TensorFlow 2.4.0?
【发布时间】:2022-07-04 23:26:33
【问题描述】:

菜鸟问题。感谢您对我的包容。

我的计算机上安装了 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 python-3.9 junit-jupiter


    【解决方案1】:

    基于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 !

    【讨论】:

    • 我最终重新安装了 Anaconda。但我相信这会奏效!谢谢。
    【解决方案2】:

    根据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.

    python 3.9不支持Tf 2.4,所以需要在conda里面安装不同版本的python 优选3.8,然后才能安装TF 2.4

    【讨论】:

      【解决方案3】:

      以下命令将帮助您在您的系统中正确安装Tensorflow 2.4

      # install pip and pip3
      $ sudo apt-get install python-pip python3-pip
      # remove old versions, if not placed in a virtual environment (let pip search for them)
      $ sudo pip uninstall tensorflow
      $ sudo pip3 uninstall tensorflow
      # install the dependencies (if not already onboard)
      $ sudo apt-get install gfortran
      $ sudo apt-get install libhdf5-dev libc-ares-dev libeigen3-dev
      $ sudo apt-get install libatlas-base-dev libopenblas-dev libblas-dev
      $ sudo apt-get install liblapack-dev
      $ sudo -H pip3 install Cython==0.29.21
      # install h5py with Cython version 0.29.21 (± 6 min @1950 MHz)
      $ sudo -H pip3 install h5py==2.10.0
      $ sudo -H pip3 install -U testresources numpy
      # upgrade setuptools 39.0.1 -> 51.0.0
      $ sudo -H pip3 install --upgrade setuptools
      $ sudo -H pip3 install pybind11 protobuf google-pasta
      $ sudo -H pip3 install -U six mock wheel requests gast
      $ sudo -H pip3 install keras_applications --no-deps
      $ sudo -H pip3 install keras_preprocessing --no-deps
      # install gdown to download from Google drive
      $ sudo -H pip3 install gdown
      # download the wheel
      $ gdown https://drive.google.com/uc?id=1W-p9oIo37xT2rQzd6KPuJq1QOBRL7-wp
      # install TensorFlow (± 12 min @1500 MHz)
      $ sudo -H pip3 install tensorflow-2.4.0-cp36-cp36m-linux_aarch64.whl
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-11-14
        • 2021-01-31
        • 1970-01-01
        • 2018-07-12
        • 2021-05-24
        • 2017-05-25
        • 2022-01-19
        • 1970-01-01
        相关资源
        最近更新 更多