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

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

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐