You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shell-project/os/get-py3104.sh

40 lines
1.4 KiB

2 years ago
#!/usr/bin/bash
path=/opt/py3104
unset c
color(){
declare -A c=([Error]=31 [Success]=32 [Warning]=33 [Info]=34)
#echo -e "\033[${c[$1]}m[`date +%T`]($1) $2\033[0m"
printf "\033[${c[$1]}m%-10s%-10s %-30s\033[0m\n" "[`date +%T`]" "($1)" "$2"
sleep 0.5
}
mkdir -pv $path
cd $path && \
yum -y install gcc gcc-c++ zlib-devel bzip2-devel sqlite-devel readline-devel libffi-devel && \
color Info "openssl 包下载,请稍等..." && \
2 years ago
wget http://download.beyourself.org.cn/package/openssl-1.1.1n.tar.gz && \
2 years ago
tar xf openssl-1.1.1n.tar.gz && \
cd openssl-1.1.1n && \
./config --prefix=/usr/local/openssl && \
make -j $(cat /proc/cpuinfo | grep processor |wc -l) && make install && cd .. && \
2 years ago
wget http://download.beyourself.org.cn/package/Python-3.10.4.tar.xz && \
2 years ago
tar xf Python-3.10.4.tar.xz && \
cd Python-3.10.4 && \
./configure --enable-shared --prefix=/usr/local/python3.10.4 --with-openssl=/usr/local/openssl --with-openssl-rpath=auto && \
make -j $(cat /proc/cpuinfo | grep processor |wc -l) && \
make install && \
echo "/usr/local/python3.10.4/lib" >> /etc/ld.so.conf && \
ldconfig && \
echo "export PATH=/usr/local/python3.10.4/bin:\$PATH" >> /etc/profile && \
color Success "python安装完成"
color Info "配置pip加速"
mkdir ~/.pip &>/dev/null
tee ~/.pip/pip.conf <<EOF
[global]
index_url=https://mirrors.aliyun.com/pypi/simple
timeout=6000
EOF
2 years ago
color Success "配置完成"