Search code examples
pythonpython-module

Installing Python modules with local Python build


I have python 2.7 installed locally in ~/Python2.7/ and I need the psycopg2 module. But when I try to install it with easy_install or compile it manually, I get

error: invalid Python installation: unable to open /usr/local/lib/python2.7/config/Makefile (No such file or directory)

I tried to change a line in ~/Python2.7/Lib/sysconfig.py from

return os.path.join(get_path('stdlib'), "config", "Makefile")

to

return '/home/foo/Python2.7/Makefile'

with no effect. What do I do to walk around this?


Solution

  • Check the command line options: http://packages.python.org/distribute/easy_install.html#command-line-options and try fiddling around with your --install-dir . The local install would also need to be in the PYTHONPATH environment variable. If you are trying to install everything locally, try using pip, instead of easy_install, and setup a virtual environment (from virtualenv).