Python tensorflow-gpu 中的“'CXXABI_1.3.8' not found” - 从源代码安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39844772/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 22:49:04  来源:igfitidea点击:

"'CXXABI_1.3.8' not found" in tensorflow-gpu - install from source

pythontensorflowcudnn

提问by user6918955

I have re-installed Anaconda2. And I got the following error when 'python -c 'import tensorflow''

我已经重新安装了 Anaconda2。当'python -c'import tensorflow''时我收到以下错误

ImportError: /home/jj/anaconda2/bin/../lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/jj/anaconda2/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so)

导入错误:/home/jj/anaconda2/bin/../lib/libstdc++.so.6:未找到版本‘CXXABI_1.3.8’(/home/jj/anaconda2/lib/python2.7/site-packages/需要)张量流/蟒蛇/_pywrap_tensorflow.so)

environment

环境

  • CUDA8.0
  • cuDNN 5.1
  • gcc 5.4.1
  • tensorflow r0.10
  • Anaconda2 : 4.2
  • CUDA8.0
  • cuDNN 5.1
  • 海湾合作委员会 5.4.1
  • 张量流r0.10
  • 蟒蛇2:4.2

the following is in bashrc file

以下是在 bashrc 文件中

  • export PATH="/home/jj/anaconda2/bin:$PATH"
  • export CUDA_HOME=/usr/local/cuda-8.0
  • export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
  • export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
  • 导出路径="/home/jj/anaconda2/bin:$PATH"
  • 导出 CUDA_HOME=/usr/local/cuda-8.0
  • 导出路径=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
  • 导出 LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

回答by gevang

Seems to be a problem with Anaconda 4.*

似乎是 Anaconda 4.* 的问题

You can either update the libgcc packageto match your local version

您可以更新 libgcc以匹配您的本地版本

conda update libgcc

but this will require downgrading "due to dependency conflicts" next time you update anaconda.

但这将需要在下次“由于依赖冲突”时降级update anaconda

OR you can mask the anaconda libstdc++ so that your system's libstdc++ is used

或者您可以屏蔽 anaconda libstdc++,以便使用您系统的 libstdc++

cd ~/anaconda2/lib
mv libstdc++.so libstdc++.so.bkp
mv libstdc++.so.6 libstdc++.so.6.bkp

You can further (optionally) create a softlink inside the anaconda lib directly

您可以进一步(可选)直接在 anaconda 库中创建软链接

ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6

These worked for me for the same problem for built-from-source (non-gpu support) tensorflow, Ubuntu 16.04, Anaconda 4.2.0.

对于从源代码构建(非 GPU 支持)张量流、Ubuntu 16.04、Anaconda 4.2.0 的相同问题,这些对我有用。

Sources:Similar problem to Building TensorFlow from source on Ubuntu 16.04 w/ GPU: `GLIBCXX_3.4.20' not foundwhich also points back to this.

来源:在带有 GPU 的 Ubuntu 16.04 上从源代码构建 TensorFlow类似的问题:未找到“GLIBCXX_3.4.20”,这也指向了这一点

回答by Xer

I solved this problem by copying the libstdc++.so.6file which contains version CXXABI_1.3.8.

我通过复制libstdc++.so.6包含 version的文件解决了这个问题CXXABI_1.3.8

Try run the following search command first:

首先尝试运行以下搜索命令:

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

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

If it returns CXXABI_1.3.8. Then you can do the copying.

如果它返回CXXABI_1.3.8. 然后就可以进行复制了。

$ cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/jj/anaconda2/bin/../lib/libstdc++.so.6

$ cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/jj/anaconda2/bin/../lib/libstdc++.so.6

回答by Javier Tognarelli

I ended up here looking for my problem, same error message but different app.

我最终在这里寻找我的问题,相同的错误消息但不同的应用程序。

My app gave the error with /lib64/libstdc++.so.6 which was pointing to /lib64/libstdc++.so.6.0.19

我的应用程序给出了 /lib64/libstdc++.so.6 指向 /lib64/libstdc++.so.6.0.19 的错误

After reading other webs, I kind of figured out I had to "replace" to where my /lib64/libstdc++.so.6 was pointing out and a newer version was located in my conda environment... so:

在阅读其他网站后,我发现我必须“替换”到我的 /lib64/libstdc++.so.6 所指出的位置,并且更新版本位于我的 conda 环境中......所以:

(sudo) rm /system/path/to/lib/libstdc++.so.6
(sudo) ln -s /path/to/conda/lib/libstdc++.so.6.0.26  /system/path/to/lib/libstdc++.so.6

So I guess it's not the best solution but as user finally get the app works.

所以我想这不是最好的解决方案,但随着用户最终让应用程序正常工作。

Also I read here, this:

我也在这里读到,这个:

Set the LD_LIBRARY_PATH before you run TF, so this lib would only be effective in this shell.

在运行 TF 之前设置 LD_LIBRARY_PATH,所以这个库只在这个 shell 中有效。

Hope this help.

希望这有帮助。

回答by saleh

Typing

打字

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/jj/anaconda2/lib/

in the terminal, will solve the problem.

终端中,将解决问题。