Search code examples
pythonubuntupsycopg

psycopg in wrong python - Ubuntu


I'm running Ubuntu. I installed python2.7 and the latest version of Postgresql.

When I installed psycopg, the package showed up in the default Ubuntu version of python instead of the 2.7 version that I want to use.

I tried to reinstall from within the directory I wanted, but it still referenced the other python. When I open the python shell, the version in 2.7.

How can I install psycopg into 2.7?

Thanks for your help.

Joe

Stack after installation:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 562, in <module>
    main()
  File "/usr/lib/python2.7/site.py", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/site.py", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/sysconfig.py", line 543, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 442, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 303, in _init_posix
    makefile = _get_makefile_filename()
  File "/usr/lib/python2.7/sysconfig.py", line 297, in _get_makefile_filename
    return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
AttributeError: 'module' object has no attribute 'pydebug'

Solution

  • apt works with the Python it installed in the first place.

    You need to use easy_install (or, better, pip) to install additional libraries to the Python you installed yourself.