Skip to content

How to Dynamically embedding the Python interpreter? #2438

@chatwyn

Description

@chatwyn

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.

  1. How to change or remove the python LC_LOAD_DYLIB command?
  2. If I can change the LC_LOAD_DYLIB command python path, How to adjust all mac.
  3. If I Remove the LC_LOAD_DYLIB command, how to dynamic load python dylib?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions