I would like to setup a default C and C++ compiler when building Python extensions under Linux. I noticed the --compiler
option to python setup.py
build, but I am wondering if there is a way of setting this as an environmental variable so that I can specify them just once.
Written in C and Python, CPython is the default and most widely used implementation of the Python language. CPython can be defined as both an interpreter and a compiler as it compiles Python code into bytecode before interpreting it.
Compile Python to CPython code can make calls directly into C modules. Those C modules can be either generic C libraries or libraries built specifically to work with Python. Cython generates the second kind of module: C libraries that talk to Python's internals, and that can be bundled with existing Python code.
MSVC is the only compiler that Cython is currently tested with on Windows. A possible alternative is the open source MinGW (a Windows distribution of gcc).
It's not possible to use an environment variable, but you can create a setup.cfg file. See Writing the Setup Configuration File. The following setup.cfg file will try to use the Intel C Compiler:
[build_ext]
compiler=icc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With