2016-08-05 83 views
3

我嘗試了我的Ubuntu 12.04 LTS系統上的TensorFlow的Anaconda installation,但是在Python中導入庫時,我遇到下面顯示的ImportError。無法在Ubuntu 12.04 LTS上正確安裝或加載Tensorflow並導致ImportError

我經歷了一個solution爲類似的線程給出,但它並沒有爲我工作。

基本上這裏就是我所做的安裝:

$ conda create -n tensorflow python=2.7 
$ source activate tensorflow 
(tensorflow)$ conda install -c conda-forge tensorflow 
(tensorflow)$ source deactivate 
$ source activate tensorflow 

然後從virtualenv中內我裝的Python,並試圖導入tensorflow。我得到的是以下錯誤:

>>> import tensorflow 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/home/anirudh/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module> 
from tensorflow.python import * 
    File "/home/anirudh/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 48, in <module> 
from tensorflow.python import pywrap_tensorflow 
    File "/home/anirudh/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module> 
_pywrap_tensorflow = swig_import_helper() 
    File "/home/anirudh/anaconda/envs/tensorflow/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: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by /home/anirudh/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so) 

如何對此進行排序?

+0

爲什麼你要堅持四年的OS版本? –

+0

恰巧我的電腦硬件不兼容軟件升級。升級會導致圖形驅動程序在重新啓動時失敗。我有一臺戴爾Vostro 3445筆記本。 – Anirudh

+0

很抱歉聽到這個消息。 –

回答

0

你需要與像gccg++一些依賴安裝libstdc++6,至少gcc-4.6版本:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test 
sudo apt-get update 
sudo apt-get install gcc-4.9 g++-4.9 
sudo apt-get install libstdc++6 

或者可以安裝linux-headersbuild-essential巫婆包含像gcc編譯器,make一些有用的工具....從源頭編譯和構建軟件的工具。

+1

謝謝!這工作。 – Anirudh

0

這個錯誤可能與你的glibc版本有關。有一些關於此的主題:Where can I get a copy of the file libstdc++.so.6.0.15

首先檢查所需版本是否在您的系統上。

$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX 

如果不上市,你可以嘗試

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test 
    $ sudo apt-get update 
    $ sudo apt-get upgrade 
    $ sudo apt-get dist-upgrade 

「sudo易於得到的dist-升級」 可能不需要。