pythonpython-3.xcythonpyhook

How to rebuild a Python module/library


I'm trying to rebuild the pyhook libary as described in this answer here.

Basically, I need to change a few lines of the C code for the pyhook module.

The problem is I don't know how to access the C code or how to rebuild the libary.

I've heard of Cython but I don't understand it and I don't know how to use it.

Also, I would like the solution to be compatible with py2exe.


Solution

  • You need to download the C code first - it's not part of the exe install. Unzip it and you then have a source tree that will build.

    To build it you'll need a C compiler. You need to use the SAME ONE as your Python version for your platform. For example, for Windows and Python 3.5 you need the latest Visual C from Microsoft.

    For pyHook you also need SWIG. Use that to construct cpyHook_wrap.c from the supplied cpyHook.i

    Then run setup.py and you should be good to go.