-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython_install.sh
37 lines (28 loc) · 1.03 KB
/
python_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
## Shell Opts ----------------------------------------------------------------
set -exuo pipefail
IFS=$'\n\t'
## Vars -----------------------------
VERSION=3.7
GITDIR=/root/github/python$VERSION
## Main ----------------------------------------------------------------------
# Check the version of current Python3
if [[ -n `python3 --version | grep -P "Python $VERSION"` ]]
then
echo "Python=$VERSION already satisfied"
exit 0
fi
# Install -------------------------------------------------------------
yum groupinstall -y "Development tools"
yum install -y ncurses-devel ncurses-libs zlib-devel mysql-devel bzip2-devel \
openssl-devel readline-devel tk-devel gdbm-devel\
db4-devel libpcap-devel xz-devel openssl-devel sqlite-devel \
uuid-devel libffi-devel libuuid-devel
if [[ ! -d $GITDIR ]]; then
git clone -b $VERSION --depth 1 https://github.com/python/cpython.git $GITDIR
fi
cd $GITDIR
./configure --prefix=/usr
make
make install
echo "Python$VERSION installed successfully!"