print_info/
print_info.rs

1use python_config::{find_interpreters, InterpreterConfig, Result};
2
3fn find_interpreter() -> Result<InterpreterConfig> {
4    for interpreter in find_interpreters() {
5        if interpreter.version.major == 3 {
6            return Ok(interpreter);
7        }
8    }
9
10    Err("No Python 3.x interpreter found".into())
11}
12
13fn main() -> Result<()> {
14    let config = find_interpreter()?;
15
16    println!("interpreter version: {}", config.version);
17    println!("interpreter path: {}", config.executable.display());
18    println!("libdir: {:?}", config.libdir);
19    println!("shared: {}", config.shared);
20    println!("base prefix: {}", config.base_prefix);
21    println!("ld_version: {}", config.ld_version);
22    println!("pointer width: {}", config.calcsize_pointer);
23
24    Ok(())
25}