#!/bin/bash
set -e
PYTHON_VERSION="3.10.12"
PYTHON_MINOR_VERSION="$(echo $PYTHON_VERSION | cut -d'.' -f 2)"
PYTHON_BUILD_VERSION="$(echo $PYTHON_VERSION | cut -d'.' -f 3)"
DOWNLOAD_PREFIX=https://registry.npmmirror.com/-/binary/python/$PYTHON_VERSION
# DOWNLOAD_PREFIX=https://www.python.org/ftp/python/$PYTHON_VERSION
yum -y install epel-release
yum -y install wget gcc zlib zlib-devel libffi libffi-devel readline-devel mysql-devel sqlite-devel
if [[ "$(rpm -E %{rhel})" == "7" ]]; then
yum -y install openssl11 openssl11-devel
export CFLAGS=$(pkg-config --cflags openssl11)
export LDFLAGS=$(pkg-config --libs openssl11)
elif [[ "$(rpm -E %{rhel})" == "8" ]]; then
yum -y install openssl openssl-devel
export LD_LIBRARY_PATH=/usr/lib64
else
echo "Unsupported CentOS version"
exit 1
fi
cd /root
wget $DOWNLOAD_PREFIX/Python-$PYTHON_VERSION.tgz -O Python-$PYTHON_VERSION.tgz
tar -xzf Python-$PYTHON_VERSION.tgz
cd /root/Python-$PYTHON_VERSION
./configure --with-ssl --enable-loadable-sqlite-extensions
make -j$(nproc) && make altinstall
alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.$PYTHON_MINOR_VERSION 0
alternatives --config python3
python3 -V
Centos7编译安装Python3.10
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 卸载mariadb 安装高版本GCC,解决编译中会遇到的GCC 5.3 or newer is required ...
- Liunx环境准备 python 安装包国内镜像 https://registry.npmmirror.com/b...
- [if !supportLists]一、[endif]python3的安装 首先,linux是自带python的,...
- 相关连接: http://www.jb51.net/article/113980.htm基础环境配置:yum -y...