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

如何在conda环境中安装TensorFlow 1.12及全部兼容依赖库

安装TensorFlow 1.12兼容conda环境完整步骤

1 创建匹配Python版本的隔离环境

TensorFlow 1.12仅适配Python 3.5/3.6版本,你此前安装失败核心原因是创建环境时未指定Python版本,conda默认安装的高版本Python无对应TensorFlow 1.12适配包,执行以下命令创建环境:

conda create -n tf12 python=3.6
conda activate tf12

2 安装兼容版本的依赖库

最新版的pandas、scikit-learn等数据科学库已经停止支持Python 3.6,需指定适配版本安装,避免依赖冲突:

conda install pandas==1.1.5 scikit-learn==0.24.2 matplotlib==3.3.4 notebook==6.4.10 numpy==1.19.5 scipy==1.5.4

上述版本均为经过验证可与Python3.6、TensorFlow1.12稳定共存的版本

3 安装TensorFlow 1.12

官方PyPi源已经下架了老旧版本TensorFlow安装包,执行以下命令从国内PyPi镜像的归档资源中安装:

pip install tensorflow==1.12 -i https://pypi.tuna.tsinghua.edu.cn/simple

若需GPU加速版本,替换为以下命令:

pip install tensorflow-gpu==1.12 -i https://pypi.tuna.tsinghua.edu.cn/simple

GPU版本需搭配CUDA 9.0、cuDNN 7.1.x运行环境,可通过conda安装对应版本cuda工具包避免系统全局环境冲突

4 验证安装结果

执行以下命令,输出版本号为1.12.0即为安装成功:

python -c "import tensorflow as tf; print(tf.__version__)"

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.24 23:45:02