Embedding Python in Another Application — Python 3.16.0a0 documentation

docs.python.org

Tin mới

Building C and C++ Extensions on Windows

Python/C API reference manual

Python Module Index

3.16.0a0 Documentation

Extending and Embedding the Python Interpreter

Very High Level Embedding¶

Embedding Python is similar to extending it, but not quite. The difference is that when you extend Python, the main program of the application is still the Python interpreter, while if you embed Python, the main program

PyRun_SimpleString()

Embedding Python is similar to extending it, but not quite. The difference is that when you extend Python, the main program of the application is still the Python interpreter, while if you embed Python, the main program

Strings and buffers

#define PY_SSIZE_T_CLEAN was used to indicate that Py_ssize_t should be used in some APIs instead of int. It is not necessary since Python 3.13, but we keep it here for backward compatibility. See Strings and buffers for

PyConfig.program_name

The simplest form of embedding Python is the use of the very high level interface. This interface is intended to execute a Python script without needing to interact with the application directly. This can for example be

PyUnicode_DecodeFSDefault()

The first program aims to execute a function in a Python script. Like in the section about the very high level interface, the Python interpreter does not directly interact with the application (but that will change in th

PyObject_GetAttrString()

The first program aims to execute a function in a Python script. Like in the section about the very high level interface, the Python interpreter does not directly interact with the application (but that will change in th

Compiling and Linking under Unix-like systems¶

It is not necessarily trivial to find the right flags to pass to your compiler (and linker) in order to embed the Python interpreter into your application, particularly because Python needs to load library modules implem

sysconfig.get_makefile_filename()

It is not necessarily trivial to find the right flags to pass to your compiler (and linker) in order to embed the Python interpreter into your application, particularly because Python needs to load library modules implem