Skip to content

Instantly share code, notes, and snippets.

@jonjack
Last active August 24, 2022 10:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jonjack/3640ce7d834e0959969917c510d6b9cc to your computer and use it in GitHub Desktop.
Save jonjack/3640ce7d834e0959969917c510d6b9cc to your computer and use it in GitHub Desktop.
#!/bin/bash
# create directory for python install
sudo mkdir -p /opt/bin
sudo chown -hR core:core /opt
cd /opt
# check for newer versions at http://downloads.activestate.com/ActivePython/releases/
wget http://downloads.activestate.com/ActivePython/releases/3.6.0.3600/ActivePython-3.6.0.3600-linux-x86_64-glibc-2.3.6-401834.tar.gz
tar -xzvf ActivePython-3.6.0.3600-linux-x86_64-glibc-2.3.6-401834.tar.gz
mv ActivePython-3.6.0.3600-linux-x86_64-glibc-2.3.6-401834 apy && cd apy && ./install.sh -I /opt/python/
# create some useful symlinks so we can call pip, python etc from anywhere (/opt/bin will already be on PATH)
ln -s /opt/python/bin/easy_install-3.6 /opt/bin/easy_install
ln -s /opt/python/bin/pip3.6 /opt/bin/pip
ln -s /opt/python/bin/python3.6 /opt/bin/python
ln -s /opt/python/bin/virtualenv /opt/bin/virtualenv
# If you want all python apps on PATH then probably better to add /opt/python/bin to PATH rather than using above symlinks
# You can do this by modifying .bashrc as follows:-
# -------------------------------------------------------------------------------------------------------------------------
# Since .bashrc is a symlink to a read-only file you first need to do this to edit it
# $ cd
# $ rm .bashrc
# $ cp /usr/share/skel/.bashrc .
#
# Now you can edit it
# $ vi .bashrc
#
# Add the following:
# export PATH=/opt/python/bin:$PATH
#
# Save and reload:
# $ source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment