安装tensorflow2.4.0虽然安装成功,但是部分包之间还存在冲突问题

控制台信息

(pytorch) C:Userswangguowei>pip install tensorflow==2.4.0
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting tensorflow==2.4.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2f/45/68e41b073b17c49dc9f02648acfd43b029072786a229465c27e9554c993e/tensorflow-2.4.0-cp37-cp37m-win_amd64.whl (370.7 MB)
     ---------------------------------------- 370.7/370.7 MB 3.8 MB/s eta 0:00:00
Requirement already satisfied: grpcio~=1.32.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (1.32.0)
Collecting numpy~=1.19.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ff/18/60ac053857fb924b0324c81200b59c00317ebaa3c14b7478266b50ffed19/numpy-1.19.5-cp37-cp37m-win_amd64.whl (13.2 MB)
     ---------------------------------------- 13.2/13.2 MB 21.9 MB/s eta 0:00:00
Requirement already satisfied: termcolor~=1.1.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (1.1.0)
Requirement already satisfied: opt-einsum~=3.3.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (3.3.0)
Requirement already satisfied: h5py~=2.10.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (2.10.0)
Requirement already satisfied: astunparse~=1.6.3 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (1.6.3)
Requirement already satisfied: six~=1.15.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (1.15.0)
Requirement already satisfied: protobuf>=3.9.2 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (3.19.6)
Collecting typing-extensions~=3.7.4
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Requirement already satisfied: tensorboard~=2.4 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (2.11.2)
Requirement already satisfied: wrapt~=1.12.1 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (1.12.1)
Collecting tensorflow-estimator<2.5.0,>=2.4.0rc0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/74/7e/622d9849abf3afb81e482ffc170758742e392ee129ce1540611199a59237/tensorflow_estimator-2.4.0-py2.py3-none-any.whl (462 kB)
     ---------------------------------------- 462.0/462.0 kB 14.6 MB/s eta 0:00:00
Collecting absl-py~=0.10
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/97/75/f5e61fb67ecbe45c31035b17562464e11b91a2b8a351bae5ca0db2969e3b/absl_py-0.15.0-py3-none-any.whl (132 kB)
     ---------------------------------------- 132.0/132.0 kB 7.6 MB/s eta 0:00:00
Collecting flatbuffers~=1.12.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/eb/26/712e578c5f14e26ae3314c39a1bdc4eb2ec2f4ddc89b708cf8e0a0d20423/flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: wheel~=0.35 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (0.38.4)
Requirement already satisfied: gast==0.3.3 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (0.3.3)
Requirement already satisfied: keras-preprocessing~=1.1.2 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (1.1.2)
Requirement already satisfied: google-pasta~=0.2 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorflow==2.4.0) (0.2.0)
Requirement already satisfied: markdown>=2.6.8 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorboard~=2.4->tensorflow==2.4.0) (3.4.3)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorboard~=2.4->tensorflow==2.4.0) (0.4.6)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorboard~=2.4->tensorflow==2.4.0) (1.8.1)
Requirement already satisfied: setuptools>=41.0.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorboard~=2.4->tensorflow==2.4.0) (65.6.3)
Requirement already satisfied: werkzeug>=1.0.1 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorboard~=2.4->tensorflow==2.4.0) (2.2.3)
Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorboard~=2.4->tensorflow==2.4.0) (0.6.1)
Requirement already satisfied: google-auth<3,>=1.6.3 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorboard~=2.4->tensorflow==2.4.0) (2.20.0)
Requirement already satisfied: requests<3,>=2.21.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from tensorboard~=2.4->tensorflow==2.4.0) (2.27.1)
Requirement already satisfied: urllib3<2.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from google-auth<3,>=1.6.3->tensorboard~=2.4->tensorflow==2.4.0) (1.26.16)
Requirement already satisfied: pyasn1-modules>=0.2.1 in d:wangguoweianaconda3envspytorchlibsite-packages (from google-auth<3,>=1.6.3->tensorboard~=2.4->tensorflow==2.4.0) (0.3.0)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from google-auth<3,>=1.6.3->tensorboard~=2.4->tensorflow==2.4.0) (5.3.1)
Requirement already satisfied: rsa<5,>=3.1.4 in d:wangguoweianaconda3envspytorchlibsite-packages (from google-auth<3,>=1.6.3->tensorboard~=2.4->tensorflow==2.4.0) (4.9)
Requirement already satisfied: requests-oauthlib>=0.7.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.4->tensorflow==2.4.0) (1.3.1)
Requirement already satisfied: importlib-metadata>=4.4 in d:wangguoweianaconda3envspytorchlibsite-packages (from markdown>=2.6.8->tensorboard~=2.4->tensorflow==2.4.0) (6.6.0)
Requirement already satisfied: idna<4,>=2.5 in d:wangguoweianaconda3envspytorchlibsite-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow==2.4.0) (3.4)
Requirement already satisfied: charset-normalizer~=2.0.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow==2.4.0) (2.0.12)
Requirement already satisfied: certifi>=2017.4.17 in d:wangguoweianaconda3envspytorchlibsite-packages (from requests<3,>=2.21.0->tensorboard~=2.4->tensorflow==2.4.0) (2022.12.7)
Requirement already satisfied: MarkupSafe>=2.1.1 in d:wangguoweianaconda3envspytorchlibsite-packages (from werkzeug>=1.0.1->tensorboard~=2.4->tensorflow==2.4.0) (2.1.3)
Requirement already satisfied: zipp>=0.5 in d:wangguoweianaconda3envspytorchlibsite-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard~=2.4->tensorflow==2.4.0) (3.15.0)
Requirement already satisfied: pyasn1<0.6.0,>=0.4.6 in d:wangguoweianaconda3envspytorchlibsite-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard~=2.4->tensorflow==2.4.0) (0.5.0)
Requirement already satisfied: oauthlib>=3.0.0 in d:wangguoweianaconda3envspytorchlibsite-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.4->tensorflow==2.4.0) (3.2.2)
Installing collected packages: typing-extensions, tensorflow-estimator, flatbuffers, numpy, absl-py, tensorflow
  Attempting uninstall: tensorflow-estimator
    Found existing installation: tensorflow-estimator 2.11.0
    Uninstalling tensorflow-estimator-2.11.0:
      Successfully uninstalled tensorflow-estimator-2.11.0
  Attempting uninstall: flatbuffers
    Found existing installation: flatbuffers 23.5.26
    Uninstalling flatbuffers-23.5.26:
      Successfully uninstalled flatbuffers-23.5.26
  Attempting uninstall: numpy
    Found existing installation: numpy 1.21.6
    Uninstalling numpy-1.21.6:
      Successfully uninstalled numpy-1.21.6
  Attempting uninstall: absl-py
    Found existing installation: absl-py 2.0.0
    Uninstalling absl-py-2.0.0:
      Successfully uninstalled absl-py-2.0.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-intel 2.11.0 requires absl-py>=1.0.0, but you have absl-py 0.15.0 which is incompatible.
tensorflow-intel 2.11.0 requires flatbuffers>=2.0, but you have flatbuffers 1.12 which is incompatible.
tensorflow-intel 2.11.0 requires numpy>=1.20, but you have numpy 1.19.5 which is incompatible.
tensorflow-intel 2.11.0 requires tensorflow-estimator<2.12,>=2.11.0, but you have tensorflow-estimator 2.4.0 which is incompatible.
Successfully installed absl-py-0.15.0 flatbuffers-1.12 numpy-1.19.5 tensorflow-2.4.0 tensorflow-estimator-2.4.0 typing-extensions-3.7.4.3

信息反馈

从您提供的控制台信息中,我们可以得到以下几点信息:

  1. 依赖冲突
    您当前的 Python 环境中存在依赖项冲突。这意味着您安装或更新的一些包与其他已安装包的版本要求不兼容。

  2. 具体的冲突包及版本

    • tensorflow-intel 2.11.0 需要 absl-py 版本至少为 1.0.0,但您的环境中安装的是 0.15.0
    • tensorflow-intel 2.11.0 需要 flatbuffers 版本至少为 2.0,但您的环境中安装的是 1.12
    • tensorflow-intel 2.11.0 需要 numpy 版本至少为 1.20,但您的环境中安装的是 1.19.5
    • tensorflow-intel 2.11.0 需要 tensorflow-estimator 版本在 2.11.02.12 之间,但您的环境中安装的是 2.4.0
  3. 成功安装的包
    尽管存在依赖冲突,以下包已成功安装或更新:absl-py-0.15.0flatbuffers-1.12numpy-1.19.5tensorflow-2.4.0tensorflow-estimator-2.4.0typing-extensions-3.7.4.3

要解决这些依赖冲突,您可以采取以下步骤:

  • 更新冲突的包:使用 pip install --upgrade 命令更新到所需的版本。例如,要更新 absl-py 到最新版本,您可以使用 pip install --upgrade absl-py
  • 创建新的虚拟环境:有时候,创建一个全新的虚拟环境并在其中安装所需包是解决依赖冲突的最简单方法。
  • 手动管理依赖:如果自动解决方案不起作用,您可能需要手动管理包的版本,确保所有包的版本都满足依赖要求。
  • 查看文档或社区:检查相关包的文档,或搜索社区论坛(如 Stack Overflow),查找类似问题的解决方案。