CentOS7.9编译安装Python3
安装系统依赖
sudo yum install -y gcc gcc-c++ make cmake automake kernel-devel zlib-devel bzip2-devel sqlite-devel openssl-devel libxslt-devel libffi-devel glib2 dbus-glib-devel xterm openssh-clients openssh-server ncurses-devel readline-devel lapack lapack-devel gcc-gfortran initscripts freetype-devel libpng-devel xdg-utils bzip2 openssl firefox unzip pciutils net-tools blas blas-devel openssh-askpass texinfo
tar -zxvf Python-3.9.9.tgz
cd Python-3.9.9
./configure --prefix=/usr/local/python3.9.9 --enable-loadable-sqlite-extensions --enable-shared
make
sudo make install
创建虚拟环境时如果提示如下报错
error while loading shared libraries: libpython3.9.so.1.0: cannot open shared object file: No such file or directory
执行如下,将缺少的库文件拷贝到系统库路径下即可
cp /usr/local/python3.9.9/lib/libpython3.9.so.1.0 /usr/lib64/
本文来自博客园,作者:GreeneGe,转载请注明原文链接:https://www.cnblogs.com/greene/p/16121620.html