ubuntu20.0 跑 paddle :ImportError: /opt/anaconda3/envs/paddle_pz/lib/python3.7/site-packages/paddle/

  • 因为官方包不支持ubuntu22.04(系统自带gcc版本与glibc版本太高)
ImportError: /home/ubuntu/anaconda3/envs/paddle/lib/python3.9/site-packages/paddle/fluid/core_avx.so: undefined symbol: _dl_sym, version GLIBC_PRIVATE
  • 参考链接:https://www.paddlepaddle.org.cn/documentation/docs/zh/install/compile/linux-compile.html
  • 原理,将利用conda安装gcc/glibc,不改系统环境的gcc/glibc,防止系统出现莫名其妙的bug。

  • 安装gcc-8,g++-8,glibc-2.17(因为paddle用的protobuf最高只支持gcc-8编译器)
# 建议用代理运行,不然比较慢
# 设置代理
conda config --set proxy_servers.http http://xxxx
# 安装
conda install -c conda-forge gcc=8 gxx=8 sysroot_linux-64=2.17
  • 重新检查你的gcc/g++版本(只影响虚拟环境,不影响系统环境)
$ gcc --version
gcc (conda-forge gcc 8.5.0-16) 8.5.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version
g++ (conda-forge gcc 8.5.0-16) 8.5.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

你可能感兴趣的:(paddle,深度学习)