Bash script to install python locally without root permissions

This bash script downloads, builds and installs a particular version of python in the location of your choice without requiring root permissions. It also creates a virtual environment that you can activate to use it. It is licensed under the terms of MIT open source license.

This script is also available on github: https://github.com/jlinoff/pybld.git

This script makes it easy to install multiple versions of python for staging tests (i.e., tests that you would want to run before installing the new version into production).

You can download it from http://projects.joelinoff.com/pybld/pybld.sh.

I have only tested it on CentOS linux and Mac OS X.

Here is how you would download and run it for a very simple case.

The script has the following options.

Long
Option
Short
Option
Description
–build-dir <dir> -b <dir> The build directory. It can be deleted after successfully installing python.
–help -h This help message.
–release-dir <dir> -r <dir> The release directory (contains bin/python).
–test -t Test the installation. Be careful, this substantially increases the installation time and may result in false positives.
–venv-dir <dir> -e <dir> The virtualenv directory (contains bin/activate).
–version <version> -v <version> The python version to install. An example would be “2.7.10”.

Enjoy!

Leave a Reply