ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

linux中conda环境下安装tensorflow-gpu以及报错问题解决

2026/9/26 16:27:17 拓冰建站 浏览量
linux中conda环境下安装tensorflow-gpu以及报错问题解决

新建conda虚拟环境

conda create -n tf1_15_0 python=3.6
conda activate tf_1_15_0
pip install tensorflow-gpu==1.15.0 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

Tensorflow与Python、CUDA、cuDNN的版本对应表
测试是否可以使用gpu:
进入python交互:

python

运行:

import tensorflow as tf
tf.test.is_gpu_available()

若输出True则可使用gpu,False则不行

解决办法:安装cuda和cudnn

报错:解决Could not load dynamic library ‘libcudart.so.10.0’; dlerror: libcudart.so.10.0: cannot open …

运行:

conda install cudatoolkit=10.0

解决Could not load dynamic library ‘libcudart.so.10.0’; dlerror: libcudart.so.10.0: cannot open …

解决TensorFlow-GPU 2.x使用GPU报错:Could not load dynamic library ‘libcudnn.so.7‘

运行

conda install -c anaconda cudnn

解决TensorFlow-GPU 2.x使用GPU报错:Could not load dynamic library ‘libcudnn.so.7‘

再次测试

进入python交互:

python

运行:

import tensorflow as tf
tf.test.is_gpu_available()

返回True 此时可以使用gpu了