-
Notifications
You must be signed in to change notification settings - Fork 0
/
installPython_Linux.sh
executable file
·45 lines (42 loc) · 1.09 KB
/
installPython_Linux.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
38
39
40
41
42
43
44
#!/usr/bin/env bash
#This script installs python 3.6.4 into ~/opt on LINUX
INSTALL_DIR=$HOME/opt/
PYTHON_VERSION=Python-3.6.4
PY_URL=https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
#If ~/opt/ does not exist
if [[ ! -d $INSTALL_DIR ]]; then
echo "Making directory $INSTALL_DIR"
mkdir $INSTALL_DIR
fi
#If dir enter into it and install
if [[ -d $INSTALL_DIR ]]; then
#Change into dir
echo "Entering dir"
cd $INSTALL_DIR
else
echo "Error:Directory not made aborting"
exit 1
fi
#Unzip if tgz is present
if [[ -f $PYTHON_VERSION.tgz ]]; then
echo "tgz file already exists installing"
#Else get python from mirror
elif wget $PY_URL; then
echo "Decompressing file...."
tar -xzf $PYTHON_VERSION.tgz #Decompress
else
echo "Download failed, is there internet?"
exit 1
fi
#Build python
if [[ -d $PYTHON_VERSION ]]; then
echo "Building Python"
cd $INSTALL_DIR$PYTHON_VERSION
configure --prefix=$HOME/opt/$PYTHON_VERSION
if make; then
make install
else
echo "It seems make is not installed try installing:
sudo apt-get update && sudo apt-get install build-essential libssl-dev openssl"
fi
fi