-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to embed python interpreter on *nix for python >3.7.3 #11439
Comments
I have tried compiling directly from source (tag: v3.7.5) and that installation doesn't face this problem. |
If I move |
I found that the conda forge builds didn't suffer from this issue. Turns out it is a single line in the recipe which is creating this problem. Looks like the prefix detection in binary files was turned off by accident: |
Has this been fixed yet? I am running into the python embed problem shown in some of the linked issues using the current anaconda distribution. |
It looks like this might affect Windows too. (PyO3/pyo3#1554) I see that the line linked in #11439 (comment) has changed for the |
I'm running into the same issue on Windows as well. I've found that in some cases, setting the use std::env;
use pyo3::{PyResult, Python, types::PyModule};
pub fn run_example() -> PyResult<()> {
let python_exe = which::which("python").unwrap();
let python_home = python_exe.parent().unwrap();
println!("Setting PYTHONHOME = {}", python_home.display());
env::set_var("PYTHONHOME", python_home);
let gil = Python::acquire_gil();
let py = gil.python();
// Find where the exe and site-packages are.
let sys = PyModule::import(py, "sys")?;
let exec: String = sys.getattr("executable")?.extract()?;
let site = PyModule::import(py, "site")?;
let site_packages: Vec<String> = site.get("getsitepackages")?.call0()?.extract()?;
println!("Found Python at: {}", exec);
println!("Site packages:");
for dir in site_packages {
println!("- {}", dir);
}
Ok(())
} |
On Linux:
On macOS:
Program that I am trying to compile (copied unmodified from python.org):
Test this on a system with no existing systemwide installation of python3 at standard locations, e.g: vanilla CentOS6
The text was updated successfully, but these errors were encountered: