Q: Debug Cython with python-dbg fails with undefined symbol: Py_InitModule4_64 I am trying to debug a small cython project following the instructions from the official Cython page. but the command: 
python-dbg setup.py build_ext --inplace
fails with the error below. I have seen responses to a similar issue here but I don't think it applies for me as I am running Cython installed via apt-get. Any help would be much appreciated. 
Traceback (most recent call last):
  File "build.py", line 4, in 
    from Cython.Build import cythonize
File "/usr/lib/python2.7/dist-packages/Cython/Build/init.py", line 1, in  from Dependencies import cythonize
File "/usr/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 51, in  from Cython.Compiler.Main import Context, CompilationOptions, default_options
File "/usr/lib/python2.7/dist-packages/Cython/Compiler/Main.py", line 17, in  from Scanning import PyrexScanner, FileSourceDescriptor
ImportError: /usr/lib/python2.7/dist-packages/Cython/Compiler/Scanning.so: undefined symbol: Py_InitModule4_64
[35101 refs]

A: I had the same problem. 
In this article the cause of it is explained:

The problem [..] is the python-dbg binary however is incompatible with
  modules not compiled with them

http://hustoknow.blogspot.de/2013/06/why-your-python-program-cant-start-when.html
My solution was to uninstall cython (which was installed via pip), clone the cython github repo and manually install it with python-dbg:
git clone git@github.com:cython/cython.git
cd cython
sudo python-dbg setup.py  install

Afterwards I was able to python-dbg setup.py build_ext --inplace in my own code.
