导入FreeCAD.so到python3模块时遇到问题。当对蟒蛇做同样的事情时-它是有效的。
源代码很简单:

import FreeCAD as fc
print(fc)
assert False

我已经在$PYTHONPATH里找到了
Python2:
name@name:/mnt/E0CA2445623DA14/Temp/GDrive/__PROJECTS/204_TORPEDO/PIM/trpdalgs/app/Laymodel$ python2 __PetrV_Laymodel.py
    FreeCAD 0.16, Libs: 0.16R6707 (Git)
    Fasteners workbench Loaded
    Sheet Metal workbench loaded
    <module 'FreeCAD' from '/usr/lib/freecad/lib/FreeCAD.so'>
    Traceback (most recent call last):
      File "__PetrV_Laymodel.py", line 8, in <module>
        assert False
    AssertionError


Python3:
name@name:/mnt/E0CA2445623DA14/Temp/GDrive/__PROJECTS/204_TORPEDO/PIM/trpdalgs/app/Laymodel$ python3 __PetrV_Laymodel.py
        Traceback (most recent call last):
          File "__PetrV_Laymodel.py", line 6, in <module>
            import FreeCAD as fc
        ImportError: dynamic module does not define module export function (PyInit_FreeCAD)

最佳答案

FreeCAD还不支持python3。正在进行此项工作,下一版本中应提供此项

09-30 14:32