Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to run gdb, but as soon as I hit enter I get this error

Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 562, in <module>
  File "/usr/lib/python2.7/", line 544, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python2.7/", line 271, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python2.7/", line 246, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python2.7/", line 236, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python2.7/", line 577, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python2.7/", line 476, in get_config_vars
  File "/usr/lib/python2.7/", line 337, in _init_posix
    makefile = _get_makefile_filename()
  File "/usr/lib/python2.7/", line 331, 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'

am I missing some package? I have 12.04


$ file /usr/bin/gdb
/usr/bin/gdb: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x8cd6c593fd6ffe6fd72266bf3d3407ea599b8143, stripped

$ dpkg -S /usr/bin/gdb
gdb: /usr/bin/gdb
share|improve this question
Same problem here, but no luck yet! – Greg Jan 30 '13 at 12:34
What's the actual command you're running? – Ken Kinder Feb 1 '13 at 20:04
@Ken: just gdb – Stefano Borini Feb 1 '13 at 22:55
Since gdb isn't a Python app, that's a little confusing. Can you run which gdb then on the file it outputs, try dpkg -S <file>> – Ken Kinder Feb 11 '13 at 0:59
@Ken: added info – Stefano Borini Feb 11 '13 at 10:47
up vote 2 down vote accepted

See StackExchange question on this issue.

GDB uses python for scripting, but appears to have problems if you have built your own version of python. It finds your new python executable, but then tries to load the system python configuration, causing a mismatch. This seems to be a problem that applies more widely to other applications that embed python.

share|improve this answer
good point indeed. I have a custom python, and that could be the cause, but now the question is how can I tell gdb not to use python at all, or to use the system python. – Stefano Borini Feb 12 '13 at 3:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.