试试我setup.py
的模板……这些东西并没有很好的记录。这里要记住的一件事是,如果您构建inplace
,您可能必须from projectname.module import module
:
try:
from setuptools import setup
from setuptools import Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
module = 'MyModuleName' # this assumes your .pyx and your import module have the same names
# ignore the below extra options if you don't need them (i.e. comment out `#`)
ext_modules = [Extension(module, sources=[module + ".pyx"],
include_dirs=[],
library_dirs=[],
extra_compile_args=[],
language='c++')]
setup(
name = module,
ext_modules = ext_modules,
cmdclass = {'build_ext': build_ext},
include_dirs = [np.get_include(), os.path.join(np.get_include(), 'numpy')]
)