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:
pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. Follow the instructions here:
Create a tmp directory
Since the user doesn't have permission to the /var/foo/bar/tmp folder, you will have a "BUILD FAILED" error. Make sure you create a tmp folder in your user's home directory and tell pyenv to use it:
[server]$ cd ~ [server]$ mkdir tmp [server]$ echo 'export TMPDIR="$HOME/tmp"' >> ~/.bash_profile
Due to resource limitations on Shared Hosting, your processes may be killed when compiling modules. The best solution is to use 'anaconda' or 'miniconda' packages under 'pyenv'.
You can find the instructions to install here:
The following steps explain how to install under your DreamHost username.
- Make sure you're in your user's home directory.
[server]$ cd ~
- Clone the repository.
[server]$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
- Run the following three commands to add lines to your .bash_profile.
[server]$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile [server]$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile [server]$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
- Restart your Shell.
[server]$ exec "$SHELL"
- Check what packages are available to install.
[server]$ pyenv install --list
- Install a package. For example:
[server]$ pyenv install anaconda-x.x.x
- Python overview
- SSH overview
- Guidelines for setting up a Python file at DreamHost
- How to install a newer version of SWIG
- Installing a custom version of Python 2
- Installing a custom version of Python 3
- Installing and using virtualenv with Python 2
- Installing and using virtualenv with Python 3
- Python setuptools