<ul>
<li>我在Ubuntu 16.04上也有同样的问题</li>
<li>这是我的解决方案</li>
<li><p>首先,在<a href="https://www.tensorflow.org/install/install_linux" rel="nofollow noreferrer">NVIDIA requirements to run TensorFlow with GPU support</a>的官方网页部分,我们可以知道:</p>
<ul>
<li>CUDA®工具箱9.0。在</li>
<li>cuDNN 7.0版。在</li>
<li>具有CUDA计算能力的GPU卡3.0或更高版本用于从源代码构建,3.5或更高版本用于我们的二进制文件</li>
</ul></li>
<li><p>所以卸载Cuda9.1。在</p>
<ul>
<li>如果不知道如何卸载,可以在Ubuntu软件中安装<code>Synaptic Package Manager</code>,然后搜索<code>cuda</code>并选择{<cd3>}</li>
<li>应用</li>
<li>重新加载<code>Synaptic Package Manager</code></li>
<li>选择Cuda-9.0<code>Mark for install</code></li>
<li>应用</li>
</ul></li>
<li><p>安装cnDNN v7.0</p>
<ul>
<li>我下载了<code>cuDNN v7.0.5 Developer Library for Ubuntu16.04 (Deb)</code>,因为它是Cuda-9.0的最新版本cudnv7.0</li>
</ul></li>
<li><p>安装<code>cuda-command-line-tools</code></p>
<p><code>
sudo apt-get install cuda-command-line-tools
</code></p>
<ul>
<li><p>如果找不到<code>cuda-command-line-tools</code></p>
<p><code>
sudo apt-cache search cuda-command-line-tool
</code></p>
<p>然后选择安装<code>cuda-command-line-tool-9.0</code></p></li>
</ul></li>
<li><p>按照官方文档,将其路径添加到LD_LIBRARY_path环境变量中</p>
<p><code>export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}/usr/local/cuda/extras/CUPTI/lib64</code></p></li>
<li><p>我使用的是Anaconda3,我使用conda命令创建环境包括py3.5名称py35。</p></li>
<li>所以,我使用<code>source activate py35</code>和{<cd14>}。在</li>
<li><p>您可以选择<a href="https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package" rel="nofollow noreferrer">tensorflow-gpu</a>哪一个支持您的python版本。</p></li>
<li><p><a href="https://www.tensorflow.org/install/install_linux#InstallingNativePip" rel="nofollow noreferrer">Validate your installation</a></p>
<ul>
<li>运行一个简短的TensorFlow程序
<code>
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
</code></li>
<li>如果系统输出<code>Hello, TensorFlow!</code>,那么就可以开始编写TensorFlow程序了。在</li>
</ul></li>
</ul>
<p><a href="https://i.stack.imgur.com/KRFWx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KRFWx.png" alt="enter image description here"/></a>
祝你好运。在</p>