-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall-python.sh
More file actions
executable file
·120 lines (86 loc) · 2.47 KB
/
install-python.sh
File metadata and controls
executable file
·120 lines (86 loc) · 2.47 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
set -e
cat << EOF
This is a script to install Python on a Chromebook.
It may work on other Debian Linux systems too.
This will:
1. Install prerequisites needed for Python on a typical Chromebook
2. Install Python 3 version that you choose
It will not install pip and virtualenv. There is a separate script to do that.
Warning - Use this script at your own risk. It may not work on all Chromebooks or setups.
This has been tested on a clean powerwashed Google Pixelbook.
If a step fails, the script will stop.
EOF
read -p "Press Enter to continue ... or Ctrl-C to cancel." START
echo
cat << EOF
Python versions I can install:
1 = Python 3.9.0
2 = Python 3.8.6
3 = Python 3.7.9
4 = Python 3.6.12
EOF
read -p "Select Python version to install (1-4): " CHOICE
case $CHOICE in
1)
VERSION=3.9
RELEASE=3.9.0
URL=https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz
;;
2)
VERSION=3.8
RELEASE=3.8.6
URL=https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz
;;
3)
VERSION=3.7
RELEASE=3.7.9
URL=https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
;;
4)
VERSION=3.6
RELEASE=3.6.12
URL=https://www.python.org/ftp/python/3.6.12/Python-3.6.12.tgz
;;
*)
echo
echo "$CHOICE is not a valid option. Aborting."
exit
;;
esac
echo
echo "I will compile Python $RELEASE from the source-code."
echo
read -n 1 -p "Are you really sure you want to continue? (Y/y): " CONFIRM
echo
if [ $CONFIRM != "Y" ] && [ $CONFIRM != "y" ]
then
echo "Aborting. "
exit
fi
echo
echo "Installing pre-requisites ..."
echo "You may be asked to input your administrator 'sudo' password (your password) ..."
sudo apt-get update
# sudo apt-get install libffi-dev
sudo apt-get install build-essential
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev curl
echo "Done."
echo
echo "Downloading Python $RELEASE from Python.org ..."
[[ -d /usr/src ]] || sudo mkdir /usr/src
cd /usr/src
sudo wget $URL
echo
echo "Unpacking and compiling Python ... this may take some time ... "
sudo tar xzf Python-$RELEASE.tgz
cd Python-$RELEASE
sudo ./configure --enable-optimizations
sudo make altinstall
echo
echo "Checking installation ..."
python$VERSION -V
echo "You can start python by typing 'python$VERSION' from the command line."
echo
echo "Finished."