1、安装依赖包
yum -install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
2、解压并安装
tar
-
zxvf Python
-
3.7
.0.tgz &&
cd Python-3.7.11
./configure --prefix=/usr/local/python3 --enable-optimizations --enable-shared
make
make install
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python
3、测试报错
python
python: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
解决:
cd /usr/local/python3/lib/
cp libpython3.7m.so.1.0 /usr/lib64
python -V