Extending Python with C: Can I specify another C compiler?

Ivan Illarionov ivan.illarionov at gmail.com
Wed Jun 4 18:36:50 CEST 2008

On Wed, 04 Jun 2008 09:12:18 -0700, spectrumdt wrote:

> Hello.
>   I am trying to extend my Python program with some C code.
>   This thread is sort of a follow-up to another thread of mine, linked
> below. I don't know what the conventions are in this newsgroup about
> creating new threads vs. staying in existing ones, but I figured I'd
> rather make a new one with a title pertaining to my current problem.
>   http://groups.google.com/group/comp.lang.python/browse_thread/thread/
>   Anyway, my question is this: When compiling my C code to include in
> Python, using a Python script with the function distutils.core.setup...
> can I choose which C compiler to use? On my system it defaults to gcc,
> but I would like to use mpicc instead (C compiler for MPI, Message
> Passing Interface).
>   Can I do this?
>   My system, in case it matters, is Fedora Linux.
>   Thanks in advance.

There is -c option for setup.py build and setup.py build_ext. If it 
doesn't work for your compiler you probably have to build your extensions 


More information about the Python-list mailing list