rust-cpython icon indicating copy to clipboard operation
rust-cpython copied to clipboard

Unclear how `rust-cpython` determines which Python interpreter to use

Open tac-tics opened this issue 6 years ago • 1 comments

I ran the example code and it loads up Python 3.5.2. However, there's nothing in the configuration or the program that says it should use this version of Python over any other.

I took a look over the documentation, and there's no way to give a path to the interpreter, nor a clear hook into explicitly calling any particular executable in GIL's acquire function or the prepare_freethreaded_python function.

Is it possible to decide to run alternative interpreters? At the very least, it should be documented how the library decides which to use.

tac-tics avatar May 07 '18 17:05 tac-tics

Is it possible to decide to run alternative interpreters? At the very least, it should be documented how the library decides which to use.

Well, at least part of the job is done in python3-sys/build.rs . All code is well documented. However, I confess I still quite confused: it seems it has some kind of "best effort" policy, favoring older 3.x versions over new one.

EDIT: Hurray! It is actually all there in cpython's Cargo.toml. Just do, e.g.:

cpython = { version = "0.2.0", features = ["python-3-6"] }

To force python3.6.

tokahuke avatar May 15 '18 17:05 tokahuke