我需要将python文件转换为.so (OSX),并使用Autodesk 2020运行这个模块。我使用Cython完成了这个操作,成功地转换了.py文件,但是当我将模块导入Maya的Python时,无法识别该模块的功能。
我不太了解Cython,也不知道编译它需要考虑什么类型的信息。
Maya Python: Python 2.7.15 (v2.7.15:ca079a3e3,2018年4月29日,20:59:26)GCC 4.2.1兼容Apple LLVM 6.0 (clang-600.0.57)
当前Python: Python2.7.16(默认值,2020年1月26日,23:50:38) GCC 4.2.1兼容Apple LLVM 9.0.0 (clang-900.0.31)
Cython : compile.py:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("test", ["test.py"])]
setup(
name = 'test',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules
)test.py
import pymel.core as pm
def do():
mesh=pm.ls(typ= "mesh")
print mesh
return meshmain.py
import test
test.do()巴什指挥部:
python compile.py build_ext --inplace我得到了.so文件,但是当我试图在Maya中导入main.py时,却找不到函数do(),
有什么想法吗?(预先谢谢:)
发布于 2021-01-26 18:18:31
嘿,伙计们,改变测试的名称似乎奏效了,我不认为这个名字会引起问题,非常感谢所有的mw
https://stackoverflow.com/questions/65878074
复制相似问题