下载安装
# wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
# tar -xf Python-3.7.2.tgz
# cd Python-3.7.2
# yum install libffi-devel gcc-c++ zlib-devel -y // 可以先装这个,防止底下那个错误
# ./configure --prefix=/usr/local/python3.7.2 --enable-optimizations
//(--enable-optimizations 启用优化,加这个后会自检测文件、安装会久一点,也可以不用这个参数)
# make && make install
# ln -s /usr/local/python3.7.2/bin/python3.7 /bin/
# ln -s /usr/local/python3.7.2/bin/pip3 /bin/
# ln -s /usr/local/python3.7.2/bin/pip3.7 /bin/
-------------------------------------------------
可能会遇到的报错:
ModuleNotFoundError: No module named '_ctypes'
make: *** [install] Error 1
解决方法:
yum install libffi-devel -y