正在开发中安装Python/Cython(扩展)模块
我一直在研究一个包含Cython的C++扩展的Python模块。正在开发中安装Python/Cython(扩展)模块,python,cython,distutils,setup.py,Python,Cython,Distutils,Setup.py,我一直在研究一个包含Cython的C++扩展的Python模块。setup.py当前处理扩展模块的构建,称为python3 setup.py--build\u ext--inplace from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize from Cython.Distutils import build_ext srcDir
setup.py
当前处理扩展模块的构建,称为python3 setup.py--build\u ext--inplace
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
srcDir = "../src"
src = ["_MyProject.pyx"] # list of source files
print("source files: {0}".format(src))
modules = [Extension("_MyProject",
src,
language = "c++",
extra_compile_args=["-fopenmp", "-std=c++11", "-O3", "-DNOGTEST"],
extra_link_args=["-fopenmp", "-std=c++11"],
libraries=["MyProjectLib", "log4cxx"],
library_dirs=["../"])]
for e in modules:
e.cython_directives = {"embedsignature" : True}
setup(name="_MyProject",
cmdclass={"build_ext": build_ext},
ext_modules=modules)
在Cython模块\u MyProject
之上,有一个纯Python模块MyProject
,它从\u MyProject
导入内容
目前,我通过
cd
-ing将模块导入其目录并从那里导入来使用和测试该模块。我需要如何修改我的setup.py
,以便将MyProject
安装到我的站点软件包中,并使软件包始终处于最新状态?将参数py_modules=[“MyProject.py”,]
添加到您的设置()中函数。如果我正确理解了这个问题,我将使用virtualenv和python setup.py develope进行此操作-请参阅,完成此操作后,我需要如何调用setup.py
以实现所需的安装?