Install Python3 on Bluehost

Bluehost is my web-hosting service of choice and has been so for close to 10 years now. To be able to run python frameworks such as Flask or Django and to have full-control over the packages and versions, it is better to install python in your home directory than to deal with the standard installed version.

The following steps assume that you have SSH access enabled on the server. These steps should work for all possible accounts: shared hosting, VPS, and Dedicated servers. These steps have worked for me for python version 3.6.4 on Ubuntu 16.04 LTS as well as CentOS 6.7.

In this installation, we will enable optimizations and also the SQLite engine (it needs to be done at install time!). Also, in the following instructions, the "path_to_install_to" points to a clean directory within your home directory that is always accessible to you.



# create and go to a temporary working directory    
mkdir ~/python-install-workspace
cd ~/python-install-workspace


# get the python source from python.org. 
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz

# Untar and unzip the archive
tar -xvf Python-3.6.5.tar.xz

# configure it for local installation. We will enable sqlite extensions, since we want to use SQLite
./configure --prefix=path_to_install_to --enable-optimizations --enable-loadable-sqlite-extensions


# make and install
make
make install

# add python3 to your path. put the following line into ~/.bashrc
export PATH=path_to_install_to/bin:${PATH}


# enjoy your python3
python3

# share this article ;) 


There, you have a shiny python 3.6.4 installation on Bluehost. Check out my other article on managing different versions of packages on different domains using pipenv on Bluehost.