Skip to content

Latest commit

 

History

History

pybind11

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

ReadMe.md

pybind11入门

Python和C/C++ 交互

底层控制的核心在于绕过Python解释器的常规机制,直接操作内存、线程、系统资源等。推荐优先使用PyBind11简化开发,但在需要极致性能或直接操作系统时,需结合Python/C API或ctypes实现精细控制。

安装pybind11

pip install pybind11==2.10.1

编译

# -undefined dynamic_lookup -arch x86_64
g++ -O3 -Wall -shared -std=c++11 -fPIC -undefined dynamic_lookup $(python3 -m pybind11 --includes) pybind11_sum.cpp -o pybind11_sum$(python3-config --extension-suffix)