简体   繁体   English

为Python扩展设置C / C ++编译器

[英]Set C/C++ compiler for Python extensions

I would like to setup a default C and C++ compiler when building Python extensions under Linux. 我想在Linux下构建Python扩展时设置默认的C和C ++编译器。 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. 我注意到python setup.py构建的--compiler选项,但是我想知道是否有一种方法可以将它设置为环境变量,这样我就可以只指定一次。

It's not possible to use an environment variable, but you can create a setup.cfg file. 无法使用环境变量,但您可以创建setup.cfg文件。 See Writing the Setup Configuration File . 请参阅编写安装配置文件 The following setup.cfg file will try to use the Intel C Compiler: 以下setup.cfg文件将尝试使用Intel C编译器:

[build_ext] 
compiler=icc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM