python3.6.4源码安装
该脚本适合centos6和ubuntu用,关于debian可以根据脚本中的范例自己添加
微笑哥与你每天进步一点点
#!/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 "时间同步中,请稍候....."
service ntpd start >/dev/null
echo $? >/dev/null
if [ $? -ne 0 ];then
yum -y install ntpd && service ntpd start >/dev/null
fi
ntpdate time.nist.gov >/dev/null
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 "=======安装前请把yum源配好,(ctrl + c停止)======="
echo "您的系统是:`cat /etc/issue`"
echo "您的内核是:`uname -r`"
echo "您的外网publicIP是:$local_IP"
#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/
echo -e "\t\t#####################"
echo -e "\t\t# 输入exit()可退出 #"
echo -e "\t\t#####################"
python3.6
python3.6.4源码安装的更多相关文章
- linux中的源码安装
前两天自己在笔记本上装了CentOs版本的虚拟机,接着要装Python3,是源码安装的挺费劲,个人总结了一些源码安装的经验,今天在这里给大家分享一下. 1. 首先准备环境,安装必要的编译工具gcc g ...
- CentOS6.5源码安装python3.5.2
前提: 1.实现自动补全需要安装模块 readline-devel (yum install -y readline-devel) 2.实现支持SSL协议需安装模块 openssl-devel (yu ...
- centos7源码安装Python3的前提条件
centos7源码安装Python3的前提条件: # yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline- ...
- CentOS7 下源码安装 python3
CentOS 7 下源码安装 python3 在CentOS7下,默认安装的是python2.7:为满足项目要求,安装python3 的方法如下: 1. 首先安装python3.6可能使用的依 ...
- [Dynamic Language] Python3.7 源码安装 ModuleNotFoundError: No module named '_ctypes' 解决记录
Python3.7 源码安装 ModuleNotFoundError: No module named '_ctypes' 解决记录 源码安装时报错 File "/home/abeenser ...
- 源码安装Python3
源码安装Python3 一.安装Python3需要的依赖包 [root@localhost ~]# yum install -y gcc make wget openssl openssl-devel ...
- centos 服务器装与python34源码安装
http://www.111cn.net/sys/CentOS/63645.htm 1.CentOS安装Python的依赖包(不安装依赖包,会导致python安装不完整) yum groupinsta ...
- 源码安装python +NGINX 的坎坷路 +uwsgi安装 部署django 的CRM项目
一.Nginx安装(基于ubuntu17.10 版本) 首先我们是基于源码安装,主要有如下步骤 1.安装依赖包 1.安装gcc g++的依赖库 sudo apt-get install build-e ...
- CentOS6源码安装vim8
CentOS6源码安装vim8 vim8相比vim7多了很多功能. 不过需要源码来进行安装. 移除旧版本的vim yum remove vim 安装依赖库 sudo yum install -y ru ...
随机推荐
- 二进制值和十六进制字符串相互转换的C++代码
#include <iostream> #include <string> #include <stdint.h> using namespace std; str ...
- hash table (youtube 2)
https://www.youtube.com/watch?v=jEdaduyLLqY
- 2017-12-01 中英文代码对比之ZLOGO 4 & LOGO
基于前文中文编程语言之Z语言初尝试: ZLOGO 4的一些评论, 此文尝试作一个非常简单的代码对比, 使讨论更加有实例根据. 下图是节选自前文最后的示例代码, 由于选取的对照LOGO版本 (alanc ...
- 函数节流scroll,兼容火狐滚轮事件
//函数节流 var wheelTimeout; var wheelFun = function (func) { if (wheelTimeout) { return; } func(); whee ...
- java Name [jdbc/myjavadb] is not bound in this Context. Unable to find [jdbc].
一.出错时的情况: 首先,这是一个servlet项目 1.项目的web.xml配置了:(后来发现不配置这个也行,但是tomcat一定要配置) <resource-ref> <desc ...
- IE9获取file控件的本地文件路径
最近发现,在IE9下,公司网站的本地图片预览都无法正常显示,经过测试发现,原因在于IE9下无法获取file控件的文件路径. 以前的代码如下: var strPic = fileImg.value; i ...
- http-server服务跨域设置
http-server --cors -p 9999 ------------------------------------------------------------------------- ...
- Android Java语法学习
Activity中有一个名称叫onCreate的方法.该方法是在Activity创建时被系统调用,是一个Activity生命周期的开始. onCreate方法的参数savedInstanceState ...
- Python之SGDRegressor
实现: # -*- coding: UTF-8 -*- import numpy as npfrom sklearn.linear_model import SGDRegressor __author ...
- scrapy之spider模块
scrapy中的spider的用法 : 1.scrapy命令行可以传参数给构造器 scrapy crawl myspider -a category=electronics 构造器接收传入的参数 im ...