Search code examples
pythoninstallationenvironment-variablessetuptools

installing pythonsetup tools to a specific python directory


I have to work on grid for which I need to install some python packages. I was trying to install pythonsetup tools, though the grid has python installed when i run python setup.py install it gives my Permission denied: '/usr/local/lib/python2.7/site-packages/test-easy-install-22642.write-test'.

Hence I went and installed python2.7 in my home directory which is in /userpath/Desktop/Python-2.7. Now can someone tell me how to do the following.

  1. Change the python path to my Desktop/Python-2.7 ie when I run python it must not run from /usr/local/bin/python instead it must run from the python installed in my home/Desktop/Python-2.7 directory.

  2. How to install setup tools to my home python directory?


Solution

  • To have local Python deployments (with site-packages) you can create isolated Python environments with a tool called virtualenv:

    http://pypi.python.org/pypi/virtualenv

    It answers your both questions

    • Overrides default Python interpreter (after activation)

    • Can have site-packages in any folder (no root access needed)