代码之家  ›  专栏  ›  技术社区  ›  Europa

无法在Anaconda环境上安装Tensorflow

  •  0
  • Europa  · 技术社区  · 1 年前

    这是我在Anaconda环境中尝试安装TensorFlow时遇到的错误

    我将python 3.11.5与此env一起使用。

    (ai-env) C:\Users\ahmet>conda install -c conda-forge tensorflow
    Channels:
     - conda-forge
     - defaults
    Platform: win-64
    Collecting package metadata (repodata.json): done
    Solving environment: | warning  libmamba Added empty dependency for problem type SOLVER_RULE_UPDATE
    failed
    
    LibMambaUnsatisfiableError: Encountered problems while solving:
      - package tensorflow-1.7.0-0 requires tensorflow-base 1.7.0, but none of the providers can be installed
    
    Could not solve for environment specs
    The following packages are incompatible
    ├─ pin-1 is installable and it requires
    │  └─ python 3.11.* , which can be installed;
    └─ tensorflow is not installable because there are no viable options
       ├─ tensorflow [0.12.1|1.0.0|...|1.9.0] would require
       │  └─ python [3.5* |3.5.* |>=3.5,<3.6.0a0 ], which conflicts with any installable versions previously reported;
       ├─ tensorflow [1.10.0|1.13.1|...|1.9.0] would require
       │  ├─ python >=3.6,<3.7.0a0 , which conflicts with any installable versions previously reported;
       │  └─ tensorflow-base [1.13.1 py36_4|1.13.1 py36_5|...|1.14.0 py36h9f0ad1d_0], which requires
       │     └─ python >=3.6,<3.7.0a0 , which conflicts with any installable versions previously reported;
       ├─ tensorflow [1.13.1|1.14.0|...|2.9.1] would require
       │  ├─ python [3.7.* |>=3.7,<3.8.0a0 ], which conflicts with any installable versions previously reported;
       │  └─ tensorflow-base [1.13.1 py37_7|1.14.0 py37hc8dfbb8_0], which requires
       │     └─ python >=3.7,<3.8.0a0 , which conflicts with any installable versions previously reported;
       ├─ tensorflow [1.10.0|1.11.0|...|2.1.0] would require
       │  └─ python [3.6* |3.6.* ], which conflicts with any installable versions previously reported;
       ├─ tensorflow [1.7.0|1.7.1|1.8.0] would require
       │  └─ tensorflow-base [1.7.0 |1.7.1 |1.8.0 ] but there are no viable options
       │     ├─ tensorflow-base [1.7.0|1.7.1|1.8.0] would require
       │     │  └─ python >=3.5,<3.6.0a0 , which conflicts with any installable versions previously reported;
       │     └─ tensorflow-base [1.13.1|1.13.2|...|1.8.0], which cannot be installed (as previously explained);
       ├─ tensorflow [2.10.0|2.8.2|2.9.1] would require
       │  └─ python 3.10.* , which conflicts with any installable versions previously reported;
       ├─ tensorflow [2.10.0|2.3.0|...|2.9.1] would require
       │  └─ python 3.8.* , which conflicts with any installable versions previously reported;
       └─ tensorflow [2.10.0|2.5.0|2.6.0|2.8.2|2.9.1] would require
          └─ python 3.9.* , which conflicts with any installable versions previously reported.
    
    Pins seem to be involved in the conflict. Currently pinned specs:
     - python 3.11.* (labeled as 'pin-1')
    
    • 在网上搜索这个特定的错误,但没有发现类似的错误。

    • 已卸载anaconda,并从新实例开始。

      还是一样。

    1 回复  |  直到 1 年前
        1
  •  1
  •   Ugochukwu Obinna    1 年前

    步骤1:取消固定Python版本(如果已固定)

    conda-config—删除pinned_packages python=3.11

    步骤2:使用兼容的Python版本创建一个新环境

    例如,TensorFlow 2.x可以很好地与Python 3.8或3.9配合使用

    conda-create-n tf_env python=3.8

    步骤3:激活新环境

    conda激活tf_env

    步骤4:安装TensorFlow

    conda install-c conda forge tensorflow