任何类似问题 libstdc++.so.6: version `GLIBCXX_3.4.26’ not found 的一个通用解决方法

libstdc++.so.6: version `GLIBCXX_3.4.26’ not found
首先我们可以吧libstdc++啥的看成一个库,然后代码可能运行时候报错说这个库没找到或者这个库里面版本没找到。那就是要更新了。当然常规更新方法可以但是如果更新不行不妨试试这个方法
先用
locate libstdc++.so.6 找出这个库的不同版本,因为通常这个库随着系统升级,conda等多个位置存在高级版本 libstdc++.so.6.3.30、 libstdc++.so.6.4.30等。

以该报错信息微为例子

Traceback (most recent call last):
  File "/home/xxy/anaconda3/envs/GWA/bin/mamba", line 7, in <module>
    from mamba.mamba import main
  File "/home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/mamba/mamba.py", line 49, in <module>
    import libmambapy as api
  File "/home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/libmambapy/__init__.py", line 7, in <module>
    raise e
  File "/home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/libmambapy/__init__.py", line 4, in <module>
    from libmambapy.bindings import *  # noqa: F401,F403
ImportError: /home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/libmambapy/../../../libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/libmambapy/bindings.cpython-310-x86_64-linux-gnu.so)
#先locate libstdc++.so.6 得到不同的版本,找最新的版本然后去查看这个版本存不存在你需要的报错的内容
# libstdc++.so.6: version `GLIBCXX_3.4.26’ not found
locate libstdc++.so.6
/usr/local/anaconda3/pkgs/libgcc-4.8.5-2/lib/libstdc++.so.6.0.19
/usr/local/anaconda3/pkgs/libgcc-7.2.0-h69d50b8_2/lib/libstdc++.so.6.0.21
/usr/local/anaconda3/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so.6
/usr/local/anaconda3/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so.6.0.30
/usr/local/lib64/libstdc++.so.6
/usr/local/lib64/libstdc++.so.6.0.24
/usr/local/lib64/libstdc++.so.6.0.24-gdb.py
/usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.19-gdb.py
/usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.19-gdb.pyc
/usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.19-gdb.pyo
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc

# 看一下找到的最高版本有没有GLIBCXX_3.4.26
strings /usr/local/anaconda3/lib/libstdc++.so.6.0.30|grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_3.4.29
GLIBCXX_3.4.30
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.6
GLIBC_2.4
GLIBC_2.3.2
# 可以看见一直到3.4.30都有
# 那直接创建软连接到目标文件夹就可以了 创建软连接要删除原文件
# 根据 ImportError: /home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/libmambapy/../../../libstdc++.so.6: version `GLIBCXX_3.4.26' not found 
#(required by /home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/libmambapy/bindings.cpython-310-x86_64-linux-gnu.so)
rm /home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/libmambapy/../../../libstdc++.so.6
# 然后软连接一个新的
ln -s /usr/local/anaconda3/lib/libstdc++.so.6.0.30 /home/xxy/anaconda3/envs/GWA/lib/python3.10/site-packages/libmambapy/../../../libstdc++.so.6

# 测试下
mamba
usage: mamba [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.

Options:

positional arguments:
  command
    clean        Remove unused packages and caches.
    compare      Compare packages between conda environments.
    config       Modify configuration values in .condarc. This is modeled after the git config command. Writes to the
                 user .condarc file (/home/xxy/.condarc) by default. Use the --show-sources flag to display all
                 identified configuration locations on your computer.
    create       Create a new conda environment from a list of specified packages.
    info         Display information about current conda install.
    init         Initialize conda for shell interaction.
    install      Installs a list of packages into a specified conda environment.
    list         List installed packages in a conda environment.
    package      Low-level conda package utility. (EXPERIMENTAL)
    remove       Remove a list of packages from a specified conda environment.
    rename       Renames an existing environment.
    run          Run an executable in a conda environment.
    search       Search for packages and display associated information.The input is a MatchSpec, a query language for
                 conda packages. See examples below.
    uninstall    Alias for conda remove.
    update       Updates conda packages to the latest compatible version.
    upgrade      Alias for conda update.
    notices      Retrieves latest channel notifications.
    repoquery    Query repositories using mamba.

options:
  -h, --help     Show this help message and exit.
  -V, --version  Show the conda version number and exit.

conda commands available from other packages:
  env
(GWA) [xxy@localhost xxy]$ mamba
usage: mamba [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.

Options:

positional arguments:
  command
    clean        Remove unused packages and caches.
    compare      Compare packages between conda environments.
    config       Modify configuration values in .condarc. This is modeled after the git config command. Writes to the
                 user .condarc file (/home/xxy/.condarc) by default. Use the --show-sources flag to display all
                 identified configuration locations on your computer.
    create       Create a new conda environment from a list of specified packages.
    info         Display information about current conda install.
    init         Initialize conda for shell interaction.
    install      Installs a list of packages into a specified conda environment.
    list         List installed packages in a conda environment.
    package      Low-level conda package utility. (EXPERIMENTAL)
    remove       Remove a list of packages from a specified conda environment.
    rename       Renames an existing environment.
    run          Run an executable in a conda environment.
    search       Search for packages and display associated information.The input is a MatchSpec, a query language for
                 conda packages. See examples below.
    uninstall    Alias for conda remove.
    update       Updates conda packages to the latest compatible version.
    upgrade      Alias for conda update.
    notices      Retrieves latest channel notifications.
    repoquery    Query repositories using mamba.

options:
  -h, --help     Show this help message and exit.
  -V, --version  Show the conda version number and exit.

conda commands available from other packages:
  env

问题就解决了,通常有很多库不存在啥的问题,都可以使用该方法,去找它的同文件版本或升级版本去创建软连接。

  • 1
    点赞
  • 1
    收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:深蓝海洋 设计师:CSDN官方博客 返回首页
评论

打赏作者

同志我累了

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值