python3.6.4源码安装
如在执行中发现有异常时,请自行排查修改
[root@master ~]# cat python3_install.sh #!/bin/bash #Check system check_sys(){ local checkType=$1 local value=$2 local release='' local systemPackage='' if [[ -f /etc/redhat-release ]]; then release="centos" systemPackage="yum" elif cat /etc/issue | grep -Eqi "debian"; then release="debian" systemPackage="apt" elif cat /etc/issue | grep -Eqi "ubuntu"; then release="ubuntu" systemPackage="apt" elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then release="centos" systemPackage="yum" elif cat /proc/version | grep -Eqi "debian"; then release="debian" systemPackage="apt" elif cat /proc/version | grep -Eqi "ubuntu"; then release="ubuntu" systemPackage="apt" elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then release="centos" systemPackage="yum" fi if [[ ${checkType} == "sysRelease" ]]; then if [ "$value" == "$release" ]; then return 0 else return 1 fi elif [[ ${checkType} == "packageManager" ]]; then if [ "$value" == "$systemPackage" ]; then return 0 else return 1 fi fi } # Get version getversion(){ if [[ -s /etc/redhat-release ]]; then grep -oE "[0-9.]+" /etc/redhat-release else grep -oE "[0-9.]+" /etc/issue fi } pre_install(){ if check_sys packageManager yum || check_sys packageManager apt; then # Not support CentOS 5 if centosversion 5; then echo -e "$[{red}Error${plain}] Not supported CentOS 5, please change to CentOS 6+/Debian 7+/Ubuntu 12+ and try again." exit 1 fi else echo -e "[${red}Error${plain}] Your OS is not supported. please change OS to CentOS/Debian/Ubuntu and try again." exit 1 fi } local_IP=`curl -s ident.me` if check_sys packageManager yum; then echo "" echo "" echo "=======安装前请把yum源配好,(ctrl + c停止)=======" echo "您的系统是:`cat /etc/centos-release`" echo "您的内核是:`uname -r`" echo "您的外网publicIP是: $local_IP" # centos的设置倒计时 kk=5 echo "时间同步中,请稍候....." systemctl start chronyd > /dev/null if [ $? -ne 0 ];then yum -y install chrony && systemctl start chronyd > /dev/null sed -i '/#server 3/a\server ntp.aliyun.com iburst' /etc/chrony.conf fi hwclock --systohc >/dev/null hwclock -w >/dev/null while [ $kk -gt 0 ];do echo -n $kk sleep 1 kk=$(($kk - 1)) echo -ne "\r \r" done fi # 系统判断 if check_sys packageManager apt; then echo "" echo "" echo "=======安装前请把apt源配好,(ctrl + c停止)=======" echo "您的系统是:`cat /etc/issue`" echo "您的内核是:`uname -r`" echo "您的外网publicIP是:$local_IP" fi # ubuntu的设置倒计时 if check_sys packageManager apt; then echo "" echo "" echo "=======安装前请把yum源配好,(ctrl + c停止)=======" echo "您的系统是:`cat /etc/issue`" echo "您的内核是:`uname -r`" echo "您的外网publicIP是:$local_IP" kk=5 echo "时间同步中,请稍候....." service ntp start >/dev/null echo $? >/dev/null if [ $? -ne 0 ];then sudo apt install ntp || service ntp restart >/dev/null fi sudo hwclock --systohc >/dev/null sudo hwclock -w >/dev/null while [ $kk -gt 0 ];do echo -n $kk sleep 1 kk=$(($kk - 1)) echo -ne "\r \r" done fi # 按任意键开始设置 get_char() { SAVEDSTTY=`stty -g` stty -echo stty raw dd if=/dev/tty bs=1 count=1 2> /dev/null stty -raw stty echo stty $SAVEDSTTY } sleep 3 echo "时间同步完毕,按任意键继续...." char=`get_char` # 系统确定后的执行命令 if check_sys packageManager yum;then yum install -y wget readline-devel gcc* elif check_sys packageManager apt; then sudo apt-get -y update sudo apt-get -y install wget lrzsz gcc make \ libbz2-dev libsqlite3-dev python3-dev libxml2-dev libffi-dev libssl-dev zlib1g-dev fi if [ ! -d /opop ];then mkdir /opop fi cd /opop/ wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz tar -zxvf Python-3.6.4.tgz || tar -xf Python-3.6.4.tgz ./ cd Python-3.6.4 ./configure --prefix=/usr/local/python3 make && make install ln -sv /usr/local/python3/bin/python3.6 /usr/bin/ yum -y install python3-pip echo -e "\t\t#####################" echo -e "\t\t# 输入exit()可退出 #" echo -e "\t\t#####################" python3.6
欢迎加入QQ群一起讨论Linux、开源等技术
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· AI 智能体引爆开源社区「GitHub 热点速览」