Building Python extension modules (MacOS)

7 views
Skip to first unread message

Andrew Voelkel

unread,
Feb 24, 2020, 10:44:55 AM2/24/20
to spyder
Hi,

I apologize for asking this question here, it's not exactly a Spyder question, but I don't know where else to turn. Googling is leading nowhere.

I've found a simple Python C API example and have got it to build from Spyder and load and be callable. I've read up enough about the C API to be comfortable with it conceptually and feel is the right approach for the C++/C interop I have to do.

But I've got questions. In lieu of an answers, a referral to an appropriate forum would be appreciated. So
  1. How do I tell distutils to use clang (it's using gcc for some reason)?
  2. How do I tell distutils to compile using the C++ compiler instead of the C compiler (I'll use "extern C" for interfacing with Python)?
  3. How do I make the build environment compatible with the Anaconda virtual environment that I'm using for Spyder, when running from a terminal window outside Spyder (I don't understand virtual environments that well)?
  4. How do I get a Spyder compatible terminal window in Spyder so I can build inside Spyder easily (I have to use some kind of Spyder extension?) ?
  5. Is distutils the thing to use? I see mention of setuptools, but have no idea whether it works for C extension modules.
Any help would be appreciated. I'm burning a lot of time going around in circles trying to find the appropriate examples and documentation.

- Andy

Reply all
Reply to author
Forward
0 new messages