You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python 3.12下TensorFlow安装失败:Python版本兼容性问题

Python 3.12 安装TensorFlow版本兼容问题解决办法

你当前使用Python 3.12安装TensorFlow时遭遇版本不兼容错误,报错显示现有可安装的TensorFlow版本仅支持Python 3.5至3.10,无法适配Python 3.12。具体报错信息如下:

Error message :LibMambaUnsatisfiableError: Encountered problems while solving:
  - nothing provides bleach 1.5.0 needed by tensorboard-1.7.0-py35he025d50_1

Could not solve for environment specs
The following packages are incompatible
├─ pin-1 is installable and it requires
│  └─ python 3.12.* , which can be installed;
└─ tensorflow is not installable because there are no viable options
   ├─ tensorflow [1.10.0|1.9.0] would require
   │  └─ python 3.5.* , which conflicts with any installable versions previously reported;
   ├─ tensorflow [1.10.0|1.11.0|...|2.1.0] would require
   │  └─ python 3.6.* , which conflicts with any installable versions previously reported;
   ├─ tensorflow [1.13.1|1.14.0|...|2.9.1] would require
   │  └─ python 3.7.* , which conflicts with any installable versions previously reported;
   ├─ 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.

解决办法

  • 降级Python版本到兼容范围
    TensorFlow从2.14版本开始正式支持Python 3.12,如果你的conda源中没有该版本,可选择降级Python到3.10(兼容TensorFlow 2.10至2.13等稳定版本):

    1. 创建新的conda环境:conda create -n tf_env python=3.10
    2. 激活环境:conda activate tf_env
    3. 安装TensorFlow:conda install tensorflow 或 pip install tensorflow
  • 安装支持Python 3.12的TensorFlow版本
    若不想降级Python,直接安装TensorFlow 2.14及以上版本:

    • 使用pip安装:pip install tensorflow>=2.14
    • 若conda源无对应版本,先更新conda:conda update conda,再执行conda install tensorflow>=2.14
  • 尝鲜安装nightly版本(测试用)
    如果需要使用最新功能,可安装TensorFlow的夜间构建版本:pip install tf-nightly

内容的提问来源于stack exchange,提问作者emna d

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 16:57:16