先贴个 setup.py 的脚本,前提是先安装好 arm-linux-gnueabihf-gcc 安装命令:sudo apt-get install gcc-arm-linux-gnueabihf 教程:https://blog.526net.com/?p=3121
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import os
os.environ[‘CC’] = ‘arm-linux-gnueabihf-gcc’
os.environ[‘LDSHARED’] = ‘arm-linux-gnueabihf-gcc -shared’
sysroot_args=[‘–sysroot’, ‘/path/to/xenial-armhf’]
setup(cmdclass = {‘build_ext’: build_ext},
ext_modules= [ Extension("core", ["core.py"]) ])