How to compile Python c-modules

On 27/05/2016 at 01:01, xxxxxxxx wrote:

Hey developers,

I want to use pygame module in Cinema R17. I placed the modules in the ....\python\packages\win64 folder and I got this fancy error:

I red about this topic in this post:

My problem is, that I am a noob :cry: and don't know how to compile wheels with the right compiler. (In this case (VS 2012 sp4). I recompiled this wheel pygame-1.9.2a0-cp27-none-win_amd64.whl using pip and it works in my python IDLE.

Maybe you know a link to a tutorial or can provide my other help :slightly_smiling_face:

On 27/05/2016 at 03:34, xxxxxxxx wrote:

Hi Matthäus,

unfortunately we don't have much more information than provided in the thread you already linked to. And we neither have the resources nor are we capable of supporting 3rd party Python modules.
But I'm counting on Niklas to jump into this thread. He's probably one of our most knowing community members with excellent Python skills.

On 27/05/2016 at 04:04, xxxxxxxx wrote:

Okay. So I will count on Niklas too :)

On 27/05/2016 at 08:28, xxxxxxxx wrote:

Compiling Pygame from scratch is pretty complicated unfortunately. You need SDL, PNG, ZLib and more,
all of which you can find here: dependencies on windows

To compile a Python C extension for Cinema 4D, you should use the Python interpreter that is embedded
within the C4D installation directory. I found it best to just copy the whole Python.win64.framework
folder to a completely new directory (one where the path contains no whitespaces!) and use the
python.exe there to execute the setup scripts in the Python modules to build them.

D:\Downloads\Python.win64.framework\python.exe build build_ext

You will need Visual Studio 2010 installed on your system to compile Python C extensions on Windows.

Hope that helps,

PS: The path to the embedded Python version is {C4D_INSTALL_DIR}/resource/modules/python/Python.win64.framework

On 27/05/2016 at 08:56, xxxxxxxx wrote:

Great! Thank you Niklas. I will try my best. :slightly_smiling_face: