首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Pyinstaller和Pymeshlab

Pyinstaller和Pymeshlab
EN

Stack Overflow用户
提问于 2022-03-17 23:21:27
回答 1查看 157关注 0票数 0

我试图让Pyinstaller使用一个使用pymeshlab的程序。下面是一个使用我想要的函数的示例python (main.py):

代码语言:javascript
运行
复制
import pymeshlab
import numpy as np

mesh_a_verts = np.array([[0., 0., 0.], [0., 0., 1.], [0., 1., 0.], [0., 1., 1.], [1., 0., 0.],
                         [1., 0., 1.], [1., 1., 0.], [1., 1., 1.], [0., 0.5, 0.5], [1., 0.5, 0.5]])

mesh_a_faces = np.array([[0, 8, 2], [2, 8, 3], [3, 8, 1], [1, 8, 0], [6, 9, 4], [7, 9, 6], [5, 9, 7],
                         [4, 9, 5], [2, 6, 4], [2, 4, 0], [3, 7, 6], [3, 6, 2], [1, 5, 7], [1, 7, 3], [0, 4, 5],
                         [0, 5, 1]], )

mesh_b_verts = np.array([[0.5, 0., 0.], [0.5, 0., 1.], [0.5, 1., 0.], [0.5, 1., 1.], [1.5, 0., 0.],
                         [1.5, 0., 1.], [1.5, 1., 0.], [1.5, 1., 1.], [0.5, 0.5, 0.5]])

mesh_b_faces = np.array([[0, 8, 2], [2, 8, 3], [3, 8, 1], [1, 8, 0], [7, 5, 4], [6, 7, 4], [2, 6, 4],
                         [2, 4, 0], [3, 7, 6], [3, 6, 2], [1, 5, 7], [1, 7, 3], [0, 4, 5], [0, 5, 1]])


def main():
    ms = pymeshlab.MeshSet()
    ms.add_mesh(pymeshlab.Mesh(mesh_a_verts, mesh_a_faces))
    ms.add_mesh(pymeshlab.Mesh(mesh_b_verts, mesh_b_faces))

    ms.generate_boolean_intersection(first_mesh=0, second_mesh=1)

    print(ms.mesh(2).vertex_matrix(), ms.mesh(2).face_matrix())


if __name__ == '__main__':
    main()

这在python中运行良好,但是当我尝试将它与Pyinstaller捆绑并运行生成的可执行文件时,我得到了错误:

代码语言:javascript
运行
复制
Traceback (most recent call last):
  File "main.py", line 29, in <module>
  File "main.py", line 23, in main
AttributeError: 'pymeshlab.pmeshlab.MeshSet' object has no attribute 'generate_boolean_intersection'
[27580] Failed to execute script 'main' due to unhandled exception!

我以为Pyinstaller丢失了一些dll,所以我把下面的内容放在我的main.spec中,但是没有帮助

代码语言:javascript
运行
复制
from pathlib import Path
import pymeshlab
from os import listdir

pmeshlab_plugins_path = Path(pymeshlab.__file__).parent / "lib" / "plugins"
pm_binaries = [(pmeshlab_plugins_path/plugin, "./pymeshlab/lib/plugins") for plugin in listdir(pmeshlab_plugins_path)]



block_cipher = None


a = Analysis(['main.py'],
             pathex=[],
             binaries=[*pm_binaries],

...

有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-21 04:10:11

pyinstaller选项这会将指定包中的所有内容复制到pyinstaller输出中,所以一定是复制了我遗漏的内容。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71520132

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档