Function find_interpreters

Source
pub fn find_interpreters() -> impl Iterator<Item = InterpreterConfig>
Expand description

Search for python interpreters and yield them in order.

The following locations are checked in the order listed:

  1. python
  2. python3
Examples found in repository?
examples/print_info.rs (line 4)
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}