5

I have done something with my python installation, don't remember what exactly. But I am getting an error when I try to open python command line now:

richard@richard-desktop:~/projects/hello$ python
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 577, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python2.7/sysconfig.py", line 344, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/lib/python2.7/config/Makefile (No such file or directory)
richard@richard-desktop:~/projects/hello$ 

Is there some way to fix this?

1
  • 1
    did you try reinstalling python2.7?
    – don.joey
    Dec 20, 2012 at 12:27

3 Answers 3

3

If you can't use apt-get try downloading python .debs and install them manually.

You can download them from here: python2.7 and python2.7-minimal. Don't forget to download the correct version for your architecture.

After that just open a terminal, change to the directory where you have downloaded the files and install them:

sudo dpkg -i python2.7-miminal*.deb
sudo dpkg -i python2.7*.deb

Note: the names in the dpkg command are not completely right. So replace them with the correct name of the files you downloaded.

1
  • Thank you, you have just saved my PC :) I was afraid I would have to reinstall. I don't know what I did to break my python installation. Dec 20, 2012 at 13:27
2

Here is some updated information when i was resolving this problem. the missing pyconfig.h comes from the following package

libpython2.7-dev:amd64: /usr/include/python2.7/pyconfig.h

i am not sure if reinstalling python-minimal helps. i solved the problem by installing python-dev

sudo apt-get install python-dev

which installed the missing libpython files. I hope this helps someone in the future.

0

Thie file in question seems to be part of the package python2.7-minimal. Try reinstalling it:

sudo apt-get --reinstall install python2.7-minimal
4
  • i am getting the same error when i run that command Dec 20, 2012 at 12:33
  • Hm, is the file really gone? Try ls /usr/lib/python2.7/config/
    – falstaff
    Dec 20, 2012 at 12:47
  • the file is there Dec 20, 2012 at 13:24
  • Can you open the file with the user you start python? Look also have a look at the permissions (using ls -la /usr/lib/python2.7/config/).
    – falstaff
    Dec 20, 2012 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .