Due to a Linux Kernel upgrade, installing a version of Python lower than 2.7.15 will fail on all DreamHost servers. If you need to install a custom version of Python, make sure it's newer than version 2.7.15.
If you'd like to install a version of Python3, view the following article:
Configuring an SSH 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:
- 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 http://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz [server]$ tar zxvf Python-2.7.15.tgz
[server]$ cd Python-2.7.15
[server]$ ./configure --prefix=$HOME/opt/python-2.7.15 --with-ensurepip=install [server]$ make [server]$ make install
- These commands install your local version of python to /home/<username>/opt/python-2.7.15.
- Navigate back to your home directory:
[server]$ cd ~
- View the creating and editing a file via SSH article for instructions on how to edit your existing .bash_profile. To add a path in order to use the new version of Python over the system default, enter the following line:
- Save and close the file and return to your shell.
- Run the following command to allow your current Shell session to use the specified version of Python 2:
[server]$ . ~/.bash_profile
- 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.
If you're using Django
If you're using Django, make sure to view the 'Django troubleshooting' article for instructions on how to use a custom version of Python.