[Numpy-discussion] Detecting Numeric.

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed Dec 11 02:38:04 CST 2002


Andrea Riciputi <ariciputi at pito.com> writes:

> How can I detect at compile time if Numeric is installed or not?? I've
> thought something like:
> 
> #ifdef NUMERIC_IS_HERE
> #include "Numeric/arrayobject.h"
> #endif

Supposing that you will use distutils for compilation and installation
of your extension module, the solution is easy: your distutils script
can test for Numeric and then add the compiler flag. For example:

   defines = []
   try:
       import Numeric
       defines.append('NUMERIC_IS_HERE')
   except ImportError:
       pass

   ...

   Extension("foo", ["foo.c"], define_macros = defines)

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------




More information about the Numpy-discussion mailing list