有没有一种方法可以使用distutils更改cython的共享库输出的名称?

2024-04-19 22:01:55 发布

您现在位置:Python中文网/ 问答频道 /正文

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,可以使用关键字setup(name='hello2',…)更改名称。但是我需要在不使用distutils的情况下获得这个功能。能做到吗?你知道吗


Tags: 模块代码confighellosopkgcythonlibs