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:

Python_Interpreter_FOUND:

Python interpreter was found

Python_Development_FOUND:

Python (development) 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:

Python version

Python_INCLUDE_DIRS:

Python include directories

Python_LIBRARIES:

Python libraries

Python_SITELIB:

Python site packages directory

The following variables with prefix PYTHON_ are now DEPRECATED and will be removed in a future version; these variables are still set for backwards compatibility. The new variables with prefix Python_ should be used instead.

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