2016-03-01 72 views
7

與GPU在Ubuntu 14.04安裝TensorFlow。對於Ubuntu/UNIX環境來說,這是相當新穎的東西,所以很多我不明白的東西。當搜索這個問題,我碰到的是無法導入CUDA 7.0實例來的時候,他們已經安裝CUDA 7.5(因爲TensorFlow不支持7.5)。我安裝了CUDA 7.0,但它似乎在尋找7.5 - 爲什麼會這樣?我在我的.bashrc文件中有以下幾行:TensorFlow(GPU)libcudart.so.7.5錯誤 - 不能打開共享對象文件

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-7.0/lib64" 
export CUDA_HOME=/usr/local/cuda-7.0 

但是我仍然看到下面的問題......任何人有任何建議嗎?

>>> import tensorflow as tf 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module> 
    from tensorflow.python import * 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module> 
    from tensorflow import contrib 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/contrib/__init__.py", line 23, in <module> 
    from tensorflow.contrib import layers 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/contrib/layers/__init__.py", line 68, in <module> 
    from tensorflow.contrib.layers.python.layers import * 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/__init__.py", line 22, in <module> 
    from tensorflow.contrib.layers.python.layers.initializers import * 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/initializers.py", line 24, in <module> 
    from tensorflow.python.ops import random_ops 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/ops/random_ops.py", line 23, in <module> 
    from tensorflow.python.framework import ops 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 39, in <module> 
    from tensorflow.python.framework import versions 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/versions.py", line 22, in <module> 
    from tensorflow.python import pywrap_tensorflow 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> 
    _pywrap_tensorflow = swig_import_helper() 
    File "/home/ford/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper 
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description) 
ImportError: libcudart.so.7.5: cannot open shared object file: No such file or directory 

回答

1

你需要從SOURCE安裝tensorflow配置設置。通過pip或easy_install進行安裝不起作用。

我使用PIP從0.6.0升級到tensorflow 0.7.1後,同樣的問題。

0

我有同樣的問題。您是否曾嘗試將CUDA 7.5與7一起安裝?這工作對我來說,我改變了我的PATH變量包括7.5而不是7.0

+0

我在安裝CUDA 7.5的安裝問題,以及由於某種原因,我無法找到我應該運行到指定要使用的CUDA版本的配置文件。我可能會嘗試安裝TensorFlow 0.7.0,因爲它默認爲7.0我認爲。 – Chimi

0

如果您正在使用最新R0.7的二進制文件,在我的經驗,他們現在已經內置在默認情況下,支持CUDA 7.5,而... R0.6二進制文件CUDA 7.0

您可以從源代碼編譯tensorflow與CUDA 7.0工作,而不是工作,看到這裏的文檔Configure TensorFlow's canonical view of Cuda libraries

$ ./configure 
Please specify the location of python. [Default is /usr/bin/python]: 
Do you wish to build TensorFlow with GPU support? [y/N] y 
GPU support will be enabled for TensorFlow 

Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave 
empty to use system default]: 7.0 

Please specify the location where CUDA 7.0 toolkit is installed. Refer to 
README.md for more details. [default is: /usr/local/cuda]: /usr/local/cuda 

Please specify the Cudnn version you want to use. [Leave empty to use system 
default]: 4.0.4 

Please specify the location where the cuDNN 4.0.4 library is installed. Refer to 
README.md for more details. [default is: /usr/local/cuda]: /usr/local/cudnn-r4-rc/ 

Please specify a list of comma-separated Cuda compute capabilities you want to 
build with. You can find the compute capability of your device at: 
https://developer.nvidia.com/cuda-gpus. 
Please note that each additional compute capability significantly increases your 
build time and binary size. [Default is: \"3.5,5.2\"]: 3.5 

Setting up Cuda include 
Setting up Cuda lib64 
Setting up Cuda bin 
Setting up Cuda nvvm 
Configuration finished 
+0

是的,我已經看到了這一點,但無法找到該配置文件,以改變其使用的庫。我通過安裝默認爲CUDA 7.0的TensorFlow 0.7.0來「解決」我的問題... – Chimi

+0

配置腳本位於頂級tensorflow源目錄中,然後執行git clone https://github.com/ tensorflow/tensorflow /斑點/主/配置 – j314erre

相關問題