1. 程式人生 > >編譯C程式碼為python模組(pyd)

編譯C程式碼為python模組(pyd)

做個備份,免得將來忘了

swig –python example.i

python setup.py build_ext --compiler=mingw32 –inplace

#setup.py

from distutils.core import setup, Extension

module1 = Extension('_example', sources=['example_wrap.c','example.c'])

setup ( name = 'example',

version = '1.0',

description = 'Simple example from SWIG tutorial',

ext_modules = [module1])