[英]/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found required by TensorFlow
I'm trying to deploy a flask app on a debian server using Machine Learning libs, i managed that so far with most ML libraries but i got this error thanks to TensorFlow which i researched a lot about it with no working solution for me.我正在尝试使用机器学习库在debian服务器上部署一个Flask应用程序,到目前为止我使用大多数 ML 库进行了管理,但是由于TensorFlow ,我得到了这个错误,我对它进行了大量研究,但没有对我有用的解决方案。
PS : I'm using a 3.7 python venv for my app PS:我正在为我的应用程序使用 3.7 python venv
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /flask/wstest/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so) Mar 01 15:32:11 django gunicorn[8803]: Failed to load the native TensorFlow runtime.
导入错误:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:未找到版本“GLIBCXX_3.4.21”(/flask/wstest/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal 需要) .so) Mar 01 15:32:11 django gunicorn[8803]:无法加载本机 TensorFlow 运行时。
I'm clearly missing the GLIBCXX 3.4.21 because strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
我清楚地错过了GLIBCXX 3.4.21因为
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
shows 3.4.20 as the latest version. strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
显示3.4.20作为最新版本。
Tried this fix add-apt-repository ppa:ubuntu-toolchain-r/test
Gives this : result of the toolchain add attempt尝试了这个修复
add-apt-repository ppa:ubuntu-toolchain-r/test
给出了这个:工具链添加尝试的结果
Tried apt-get update, Got this尝试 apt-get 更新,得到这个
W: Failed to fetch http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found
W:无法获取http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found
Also tried to update libgcc and libstdc++6, says i have the latest version.还尝试更新 libgcc 和 libstdc++6,说我有最新版本。
EDIT : I'm suspecting that Debian 8 Jessie doesn't support a higher glibcxx version than the 3.4.20.编辑:我怀疑 Debian 8 Jessie 不支持比 3.4.20 更高的 glibcxx 版本。
Here's a solution for this problem in Ubuntu 16.04这是 Ubuntu 16.04 中此问题的解决方案
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6
You can check if you get GLIBCXX desired version like this:您可以检查是否获得了 GLIBCXX 所需的版本,如下所示:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
So, i just tested Stretch and it works fine.所以,我刚刚测试了Stretch ,它工作正常。 The issue is related to the OS in this case Debian 8 Jessie , it cannot handle a higher version of glibcxxx than the 3.4.20.
在这种情况下,该问题与Debian 8 Jessie的操作系统有关,它无法处理比 3.4.20 更高版本的 glibcxxx。
PS : Stretch is Debian 9 's distribution name PS : Stretch是Debian 9的发行版名称
If you're using Anaconda/Miniconda, you can also get your OS to use the libstdc++.so.6
provided with your installation by setting your LD_LIBRARY_PATH
environment variable.如果您使用的是 Anaconda/Miniconda,您还可以通过设置
LD_LIBRARY_PATH
环境变量,让您的操作系统使用随安装提供的libstdc++.so.6
。 Say you have Miniconda installed in /home/whatever/miniconda3
and you're using bash
.假设您在
/home/whatever/miniconda3
miniconda3 中安装了/home/whatever/miniconda3
并且您正在使用bash
。 Then add this to your ~/.bashrc
:然后将其添加到您的
~/.bashrc
:
export LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/:/home/whatever/miniconda3/lib
source ~/.bashrc
or restart your shell and you should be good to go. source ~/.bashrc
或重新启动你的shell,你应该很高兴。
See also: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths and How to update libstdc++.so.6 or change the file to use on Tensorflow, Python .另请参阅: https : //gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths和How to update libstdc++.so.6 or change the file to use on Tensorflow, Python 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.