To fix that error, you have three choices:
- Build your project in Release mode
#undef _DEBUG before
- Build CPython in Debug mode
Unfortunately we don't have any nice straightforward guides for developing native Python modules, and as far as I know python.org doesn't have any either. It's really an art right now that requires a solid understanding of how Python's import system works and
a lot of persistence to keep trying until it works.
You will also need to get Visual Studio 2008 (or Visual C++ 2008 Express if you can find it) to compile for Python 2.7. Alternatively, if you install the
Windows SDK for .NET 3.5
and also the
Windows SDK for .NET 4.0
then you will be able to select the v90 platform toolset in the project properties for your native module. (Another alternative is to be really
careful that you don't use native Python APIs with file descriptors or
pointers. If you plan to redistribute your module as source code on PyPI/pip, end-users will only be able to compile it automatically with VS 2008.)
Did I mention this is complicated? :( Most people who have made it work are highly skilled C/C++ developers. If you are not, you may want to consider
, which will produce native modules from a Python-like syntax. I believe you will still need VS 2008 for this, though you may be able to configure Cython to use a later version.
One thing we do want to do in the future is produce a guide and template for developing native Python modules using Visual Studio. Right now however, there are a few issues that complicate it too much that we are trying to simplify (access to the necessary
compilers is one of them), as well as the fact that we are currently focused on other feature areas. I personally am keen to improve this area though, so I'm sure it'll happen eventually.