安装 g++ 4.8 时找不到 libpython2.7.20.1.0

libpython2.7.20.1.0 not found while installing g++ 4.8

我正在尝试使用以下命令将我的 Centos6 系统升级到 g++ 4.8:

$ wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
$ yum install devtoolset-2-gcc devtoolset-2-binutils
$ yum install devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran

但是我在第 2 步遇到错误:

 #  yum install devtoolset-2-gcc devtoolset-2-binutils
 /usr/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

我已经从我的 Anaconda 路径安装了 anaconda 4.4 和 运行 Python 3.6。我不确定为什么在尝试升级 g++ 时会看到此错误。

编辑 /etc/ld.so.conf 和 运行 ldconfig,如 this answer 所示。