pyo3
pyo3 copied to clipboard
How to Dynamically embedding the Python interpreter?
Hi
When I use cargo build
to generate executable, then I use otool -l “executable-path”
, It will show LC_LOAD_DYLIB command about python.
Load command 13
cmd LC_LOAD_DYLIB
cmdsize 104
name /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/Python (offset 24)
time stamp 2 Thu Jan 1 08:00:02 1970
current version 3.9.0
compatibility version 3.9.0
But I Need to distribute the executable to users whose computers do not have the python Path, Then will run error. So I have some problems.
- How to change or remove the python LC_LOAD_DYLIB command?
- If I can change the LC_LOAD_DYLIB command python path, How to adjust all mac.
- If I Remove the LC_LOAD_DYLIB command, how to dynamic load python dylib?
I think the easiest way is probably to use PyOxidizer to embed the interpreter into your binary?