Cython代码可以编译为
cython hello.pyx -o hello.c
gcc -shared -fPIC hello.c -o hello.so `pkg-config python --libs --cflags`
但是如果你将hello.so
更改为hello2.so
,由于假设函数inithello2
将存在于python模块hello2.so
中,模块将无法在python中导入。使用distutils,您可以使用关键字更改名称(name =' hello2',...)。但我需要在不使用distutils的情况下获得此功能。可以吗?