我在自己构建的 python 上尝试运行 Ubuntu 12.04.1 系统 gdb 时遇到了这个问题。我希望 Ubuntu 已经在系统 gdb 中构建了一些钩子,以便它使用 Python 的调试版本;但是这些钩子并没有抓住我自己的蟒蛇中的任何东西。我通过构建自己的 gdb 并运行它来解决这个问题。
这是命令行和完整的回溯:
price@neverland:~/LSST/ip_diffim[master] $ gdb --args python tests/SnapPsfMatch.py
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 337, in _init_posix
makefile = _get_makefile_filename()
File "/usr/lib/python2.7/sysconfig.py", 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'
/usr/lib
因此,尽管我已告诉系统不要这样做,但它似乎仍在寻找错误的 python (in ):
price@neverland:~/LSST/ip_diffim[master] $ which python
/home/price/eups/Linux/python/2.7.2/bin/python
price@neverland:~/LSST/ip_diffim[master] $ echo $PYTHONPATH | grep usr
price@neverland:~/LSST/ip_diffim[master] $