From charlesreid1

No edit summary
No edit summary
Line 19: Line 19:
$ python setup.py install --prefix=${HOME}/pkg/virtualenv
$ python setup.py install --prefix=${HOME}/pkg/virtualenv
</pre>
</pre>
[[Category:Python]]

Revision as of 19:03, 20 November 2013

If you don't want to deal with the difficulties of installing a system version of Python, or you don't have the permissions to do so, you have another option: install a virtual version of Python, called virtualenv.

This can be obtained from here: http://pypi.python.org/pypi/virtualenv

Essentially you install it to a prefix, where it will create a /prefix/bin/ and /prefix/lib/ directory. Then a python binary is put into /prefix/bin/, and it wraps the system python and so can load all relevant libraries, etc., but can also load libraries in /prefix/lib/ so that you can extend Python, without ever touching the system version of Python.

Install it by running:

$ python setup.py install --prefix=${HOME}/pkg/virtualenv

or wherever you want to install it.

Then, whenever you want to install a Python package and make it loadable by virtualenv, you just append the same --prefix to the end of setup.py:

$ cd /path/to/package
$ python setup.py install --prefix=${HOME}/pkg/virtualenv