[−][src]Crate python_config
python-config
Just like the python[3]-config script that's installed
with your Python distribution, python-config helps you
find information about your Python distribution.
use python_config::PythonConfig; let cfg = PythonConfig::new(); // Python 3 // Print include directories println!("Includes: {}", cfg.includes().unwrap()); // Print installation prefix println!("Installation prefix: {}", cfg.prefix().unwrap());
python-config may be most useful in your build.rs
script, or in any application where you need to find
- the location of Python libraries
- the include directory for Python headers
- any of the things available via
python-config
Essentially, this is a reimplementation of the
python-config script with a Rust interface. We work
directly with your Python interpreter, just in case
a python-config script is not on your system. In fact
we provide a binary, python-config in case (for whatever
reason) you'd like to use this version of python-config
instead of the distribution's script. We have tests that
show our script takes the exact same inputs and returns
the exact same outputs. Note that the tests only work if
you have a Python 3 distribution that includes a
python3-config script.
3 > 2
We make the opionin for you: by default, we favor Python 3
over Python 2. If you need Python 2 support, use the more
explicit interface to create the corresponding PythonConfig
handle.
The python-config binary in this crate is Python 3 only.
Structs
| PythonConfig | Exposes Python distribution information |
Enums
| Error | A |
| Version | Selectable Python version |
Type Definitions
| Py3Only | The result type denotes that this function is only available when interfacing a Python 3 interpreter. |
| PyResult | The result type denoting a return |