1
    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 321, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory)

I know this is very similair to this question but i'm still not able to solve it

This doesn't really have anything to do with command-not-found error because even when i do remove command-not-found program it still appears.

Also executing the command gives the following output.

$ which python
/usr/bin/python
$ python
<gives the same error pasted above>

How do i solve it? None of my programs in ubuntu are working.

Community
  • 1
  • 1
gaara87
  • 2,087
  • 3
  • 21
  • 43

2 Answers2

3

After a lot of discussion and help from ppl on irc!

As one of the comments to the questions have suggested, the main instruction that was suggested by many ppl was

apt-get install --reinstall packagename

but it did not really seem to help.

So i simply downloaded python2.7-minimal_2.7.2-5ubuntu1_amd64.deb from the ubuntu package sites and

$ sudo dpkg -i python2.7-minimal_2.7.2-5ubuntu1_amd64.deb

voila it worked! once you finish that, make sure you update!

gaara87
  • 2,087
  • 3
  • 21
  • 43
0

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.

DevZer0
  • 13,433
  • 7
  • 27
  • 51