0

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?

3
  • Try installing easy_install locally as well. Commented May 20, 2011 at 16:10
  • easy_install was already installed locally. Honestly, Python was not installed, only compiled, and I have only created a symlink to the binary in ~/bin/. Commented May 20, 2011 at 17:01
  • Does the shebang of easy_install point to your local Python? Commented Feb 25, 2012 at 5:17

1 Answer 1

2

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).

Sign up to request clarification or add additional context in comments.

2 Comments

Well, the command line options are no good... install-dir is where the module, not Python, is installed. I think I'll try to persuade the admin to install python 2.7 globally, after all.
virtualenv is perfect for this. You build Python from source to the desired --prefix, and then you can use virtualenv --python /path/to/your/local/python/exe ... to create an environment in which you can install any desired package using either easy_install or pip. Without elevating privileges! Upvoting this answer since it mentions virtualenv.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.