Skip to content

Instantly share code, notes, and snippets.

@tianweidut
Created July 26, 2022 14:26
Show Gist options
  • Save tianweidut/abb318d945c9b54f7789f4f27d8fc7f7 to your computer and use it in GitHub Desktop.
Save tianweidut/abb318d945c9b54f7789f4f27d8fc7f7 to your computer and use it in GitHub Desktop.
python install
#!/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