centos7安装Python3.7
程序员文章站
2022-03-11 22:52:37
...
`CentOS 7.6 默认安装了 Python 2.7.5**
一.准备环境
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim -y
yum install libXcomposite libXcursor libXi libXtst libXrandr alsa-lib mesa-libEGL libXdamage mesa-libGL libXScrnSaver -y
# Python3.7及以上版本需要安装libffi-devel,否则安装时会报错 ModuleNotFoundError: No module named 'ctypes'错误
yum install libffi-devel -y
二.下载Python安装包
下载python安装包
三.解压
tar -zxvf Python-3.7.2.tar.xz
四.编译与安装
cd Python-3.7.2/
./configure --enable-shared --prefix=/usr/local CFLAGS=-fPIC LDFLAGS="-Wl,-rpath /usr/local/lib"
make -j24
make install
五.做软连接
ln -sf /usr/local/bin/python3.7 /usr/bin/python3
ln -sf /usr/local/bin/python3.7 /usr/bin/python3.7
ln -sf /usr/local/bin/pip3.7 /usr/bin/pip3
ln -sf /usr/local/bin/pip3.7 /usr/bin/pip3.7
六.
python3 --version
版权声明:如无特殊说明,文章均为本站原创,转载请注明出处
本文链接:https://blog.csdn.net/wsad861512140