代码拉取完成,页面将自动刷新
同步操作将从 mirokymac/kiauh 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
# author: mirokymac 2021-11-21
# using ustc source
echo "This script will check Python3 version.\nIf Python3 < 3.7 then mods the deps and install python3.\nThe compiling will take about 20 min on RPi3."
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cat > /etc/apt/sources.list<<EOF
# simple USTC http sources
deb http://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free
EOF
mkdir -p ~/backup/apt.d/
sudo mv /etc/apt/sources.list.d/* ~/backup/apt.d/
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y ca-certificates
### python 3 check and mods
echo "Your Python 3 version is: $(python3 --version)"
py_chk_ok=$(python3 -c 'import sys; a, b = sys.version_info[:2]; print(a+b/10 >=3.7)')
main_python3="$(python3 -c 'import sys; a, b = sys.version_info[:2]; print(a+b/10)')"
sudo apt-get upgrade -y
sudo apt-get install -y python3-virtualenv
if [ $py_chk_ok = "False" ];then
# set -e
sudo sed -i "s/python3/python${main_python3}/g" /usr/bin/virtualenv
sudo sed -i "s/python3/python${main_python3}/g" /usr/bin/lsb_release
PYTHONDEP="make build-essential libssl-dev zlib1g-dev libbz2-dev"
PYTHONDEP="${PYTHONDEP} libreadline-dev libsqlite3-dev wget curl"
PYTHONDEP="${PYTHONDEP} llvm libncurses5-dev xz-utils tk-dev libffi-dev"
sudo apt-get install -y ${PYTHONDEP}
# ali npm mirror
wget https://registry.npmmirror.com/-/binary/python/3.8.12/Python-3.8.12.tar.xz
tar -xf ./Python-3.8.12.tar.xz
cd ./Python-3.8.12
./configure --enable-optimizations
make -j4
sudo make altinstall
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${main_python3} 1
sudo update-alternatives --auto python3
echo "\n\n"
echo "Python3 install finished."
echo "To rewrite the APT sources, run the commands below:"
echo "\tsudo mv ~/backup/apt.d/* /etc/apt/sources.list.d/"
echo "\tsudo rm /etc/apt/sources.list"
echo "\tsudo mv /etc/apt/sources.list.bak /etc/apt/sources.list"
echo "\tsudo rm -rdf ~/backup/apt.d"
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。