Installing a custom version of Python

As of May 2017, DreamHost currently runs Python v2.7.3.

To install a custom Python version, you must download the version from The following describes how to install Python 2.7.7 under your website user:

To run the commands in this article, you must log into your server via SSH with your Shell user. View the following articles for more information:

Installing Python

  1. Log into your server via SSH, and then run the following commands one at a time:
    [server]$ cd ~
    [server]$ mkdir tmp
    [server]$ cd tmp
    [server]$ wget
    [server]$ tar zxvf Python-2.7.7.tgz 
    [server]$ cd Python-2.7.7
    [server]$ ./configure --prefix=$HOME/opt/python-2.7.7 [server]$ make [server]$ make install
    • These commands install your local version of python to /home/<username>/opt/python-2.7.7.
  2. Add the following line to the bottom of your .bashrc file:
    source .bash_profile
  3. To add a path in order to use the new version of Python over the system default, enter the following line to your .bash_profile file which is in your user's directory:
    export PATH=$HOME/opt/python-2.7.7/bin:$PATH
  4. Run the following command to update this file:
    [server]$ . ~/.bash_profile
  5. Check which version of Python you're now using by entering the following command:
    [server]$ which python
    It should respond with this:

    If it responds with a path like /usr/bin/python, then the newly downloaded copy is not being used. Most often this is due to the .bash_profile not being updated correctly. Try logging out and back in again. If necessary, repeat the steps above.

See also

Did this article answer your questions?

Article last updated .