Pop Os 19.04 使用Python3构建CUDA

2024-06-28 20:05:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在运行带有NVIDIA显卡的ubuntu19.04(pop d os)。我想在GPU而不是CPU中运行python代码。我在这个链接中安装了CUDA 10和cudn mentioed https://support.system76.com/articles/cuda/ 使用pip和pip3安装tensorflow gpu 1.14。。并编写了以下代码:

import tensorflow as tf
print(tf.test.is_built_with_cuda())

用python和python3在终端上运行代码:

$python test.py
True
$python3 test.py
False

如您所见,该脚本似乎在GPU中与Python2一起运行,而与Python3不兼容。我有一个用Python3编写的TensorFlow代码,需要很长时间才能运行。我想让它在GPU上运行,我把图形从Intel切换到NVIDIA。我试过cuda和cudnn的几种版本,但都不起作用。我跟踪了所有这些链接,但仍然返回false:

https://support.system76.com/articles/install-tensorflow/

https://blog.eduonix.com/software-development/install-tensorflow-gpu-cuda-python-3/

https://medium.com/@mishra.thedeepak/cuda-and-cudnn-installation-for-tensorflow-gpu-79beebb356d2

https://www.tensorflow.org/install/source#linux

Tensorflow command tf.test.is_gpu_available() returns False


Tags: install代码httpstestcomsupportgpu链接