Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass flags to a distutils extension? [duplicate]

I'm trying to install a Python module that contains C modules. The C code relies on a library being available in the system's global install locations (/usr/include, /usr/lib), but in my case I only have a local installation of this lib available. Therefore, I would like to pass parameters (e.g., --incdir, --libdir) when calling "setup.py build" so that these values end up in the setup script.

Is there a way to achieve this?

like image 208
BjoernD Avatar asked Nov 13 '11 13:11

BjoernD


1 Answers

I found out that prepending

CFLAGS="-I<local include dir>" LDFLAGS="-L<local lib dir>"

to the command line when calling setup.py did the trick.

like image 58
BjoernD Avatar answered Sep 22 '22 15:09

BjoernD