aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-12-21 15:05:56 +0000
committerMatthew Lemon <lemon@matthewlemon.com>2020-12-21 15:05:56 +0000
commitf766bd8ad8c46e9a7b9010fe9681ff8db5a96add (patch)
treed988adb5880bade9131ce3fcb40ebb54d08df9af
parent781763832aee97f4637c6986ec63fdb72a76d98a (diff)
added a compile python script for Arch Linux
-rwxr-xr-xcompile_python_arch.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/compile_python_arch.sh b/compile_python_arch.sh
new file mode 100755
index 0000000..99ed45b
--- /dev/null
+++ b/compile_python_arch.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+## run like this: ./compile_python_arch.sh 3.9.1 (for example)
+
+# Python 3.7 version: latest 3.7.9
+# Python 3.8 version: latest 3.8.6
+# Python 3.9 version: latest 3.9.1
+
+PYTHON_VERSION=$1
+
+echo "Updating system...."
+# sudo pacman -Syu --noconfirm
+# sudo pacman -S --noconfirm base-devel openssl zlib readline sqlite3 wget curl llvm ncurses xz
+# sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm
+# sudo apt-get install -y libncurses5-dev libncursesw5-dev xz-utils tk-dev
+
+cd $HOME/Downloads
+
+wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz
+
+DIR="$HOME/.python$PYTHON_VERSION"
+
+if [ -d $DIR ]
+then
+ echo "$0: directory '$DIR' exists."
+ echo "Not overwriting existing Python installation. Exiting."
+ exit 1
+else
+ echo "Creating $DIR..."
+ mkdir $DIR
+fi
+
+tar -xvf Python-$PYTHON_VERSION.tar.xz
+cd Python-$PYTHON_VERSION
+#e we set LDFLAGS pointing to install directory if system does not have libpython3.6 Here we set LDFLAGS pointing to install directory if system does not have libpython3.6
+./configure --prefix="$DIR" LDFLAGS="-Wl,--rpath=$DIR/lib"
+#./configure --prefix="$DIR" --enabled-shared LDFLAGS="-Wl,--rpath=$DIR/lib"
+make
+make install
+cd ~
+rm -rf $HOME/Downloads/Python-$PYTHON_VERSION
+rm $HOME/Downloads/Python-$PYTHON_VERSION.tar.xz
+echo "Create a symlink with 'sudo ln -s $DIR/bin/python3 /usr/local/bin/python$PYTHON_VERSION'"
+echo "Done...!"