ecbuild_find_python

Find Python interpreter, its version and the Python libraries.

ecbuild_find_python( [ VERSION <version> ] [ REQUIRED ] [ NO_LIBS ] )

Options

VERSIONoptional

minimum required version

REQUIREDoptional

fail if Python was not found

NO_LIBSoptional

only search for the Python interpreter, not the libraries

Unless NO_LIBS is set, the python-config utility, if found, is used to determine the Python include directories, libraries and link line. Set the CMake variable PYTHON_NO_CONFIG to use CMake’s FindPythonLibs instead.

Output variables

The following CMake variables are set if python was found:

PYTHONINTERP_FOUND

Python interpreter was found

PYTHONLIBS_FOUND

Python libraries were found

PYTHON_FOUND

Python was found (both interpreter and libraries)

PYTHON_EXECUTABLE

Python executable

PYTHON_VERSION_MAJOR

major version number

PYTHON_VERSION_MINOR

minor version number

PYTHON_VERSION_PATCH

patch version number

PYTHON_VERSION_STRING

Python version

PYTHON_INCLUDE_DIRS

Python include directories

PYTHON_LIBRARIES

Python libraries

PYTHON_SITE_PACKAGES

Python site packages directory