-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-python3.sh
More file actions
executable file
·71 lines (54 loc) · 1.69 KB
/
install-python3.sh
File metadata and controls
executable file
·71 lines (54 loc) · 1.69 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
VERSION="3.8.11"
VER=$(echo ${VERSION} | awk 'BEGIN{FS="."} {print $1"."$2}')
# --------------------------------------------------
# Update the package and install the requirements.
# --------------------------------------------------
sudo apt-get update
sudo apt-get install -y \
build-essential \
checkinstall \
tk-dev \
zlib1g-dev \
libncurses5-dev \
libgdbm-dev \
libnss3-dev \
libssl-dev \
libsqlite3-dev \
libreadline-dev \
libffi-dev \
libbz2-dev \
libpcre3 \
libpcre3-dev
# --------------------------------------------------
# Create the temporary directory.
# --------------------------------------------------
if [ ! -d ${HOME}/temp ]; then
mkdir ${HOME}/temp
fi
# --------------------------------------------------
# Download the source code.
# --------------------------------------------------
cd ${HOME}/temp
wget https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz
tar -xvf Python-${VERSION}.tgz
# --------------------------------------------------
# Compile the source code and install.
# --------------------------------------------------
cd Python-${VERSION}
./configure --enable-optimizations
sudo make
sudo make altinstall
# --------------------------------------------------
# Check whether Python 3.x.y install succeed.
# --------------------------------------------------
if [ ! -x /usr/local/bin/python${VER} ]; then
echo "ERROR! Python ${VERSION} is not install correctly."
exit 1
fi
# --------------------------------------------------
# Make clean.
# --------------------------------------------------
rm -rf ${HOME}/temp/Python-${VERSION}
rm ${HOME}/temp/Python-${VERSION}.tgz
# END