Created
July 26, 2022 14:26
-
-
Save tianweidut/abb318d945c9b54f7789f4f27d8fc7f7 to your computer and use it in GitHub Desktop.
python install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
if [[ ! -z ${DEBUG} ]]; then | |
set -x | |
fi | |
ulimit -n 65535 || true | |
rootdir=/opt/python-workdir | |
install() { | |
echo "------------------------" | |
echo "start to install python ${1}..." | |
py_name=Python-${1} | |
curl https://www.python.org/ftp/python/${1}/${py_name}.tgz -o ${rootdir}/${py_name}.tgz | |
tar -xf ${rootdir}/${py_name}.tgz -C ${rootdir} | |
rm -rf ${rootdir}/${py_name}.tgz | |
cd ${rootdir}/${py_name} | |
echo "configure, complie and install..." | |
./configure --enable-optimizations --quiet | |
make install --quiet | |
rm -rf ${rootdir}/${py_name} | |
echo "current python version:" | |
python3 --version | |
echo "upgrade base packages" | |
python3 -m pip install -U pip | |
cd - | |
} | |
for _v in "$@" | |
do | |
install $_v | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment