简体   繁体   English

Meshlab 脚本从 Python venv 工作,但不是在 pyinstaller 之后

[英]Meshlab script works from Python venv, but not after pyinstaller

I have a simple Python script Mesher.py which takes file name strings in Windows format on the command line and runs MeshLab on the input point cloud (.xyz file):我有一个简单的 Python 脚本Mesher.py ,它在命令行上采用 Windows 格式的文件名字符串,并在输入点云(.xyz 文件)上运行 MeshLab:

import sys
from pathlib import Path
import pymeshlab as ml

xyz_file = Path(sys.argv[1]).as_posix()
output_file = Path(sys.argv[2]).as_posix()

ms = ml.MeshSet()
ms.load_new_mesh(xyz_file)
ms.load_filter_script('filters.mlx')
ms.apply_filter_script()
ms.save_current_mesh(output_file)

It runs fine from the Python 3.9.6 interpreter in a virtual environment, but when I package it with pyinstaller (also installed to the venv) to make a Windows executable out of it I get this error when I run the .exe with the same command line arguments:它在虚拟环境中从 Python 3.9.6 解释器运行良好,但是当我用 pyinstaller(也安装到 venv)将它打包以生成 Windows 可执行文件时,当我运行 .exe 时出现此错误。命令行参数:

    Traceback (most recent call last):
      File "Mesher.py", line 9, in <module>
        ms.load_new_mesh(xyz_file)
    pymeshlab.pmeshlab.PyMeshLabException: Unknown format for load: xyz
    [24580] Failed to execute script Mesher

Why does pymeshlab recognize my .xyz file fine from Python but not when the same script is wrapped up in a Windows executable?为什么 pymeshlab 可以很好地从 Python 识别我的 .xyz 文件,但在 Windows 可执行文件中包含相同的脚本时却不能识别?

EDIT This also happens when I use a fixed file name for my .xyz file rather than passing it on the command line, or even if I use a .ply file for the input.编辑当我为 .xyz 文件使用固定文件名而不是在命令行上传递它时,或者即使我使用 .ply 文件作为输入,也会发生这种情况。 The .exe version of my script doesn't recognize standard MeshLab file types.我的脚本的 .exe 版本无法识别标准的 MeshLab 文件类型。

我能够通过使用 cx_Freeze 而不是 pyinstaller 来实现它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pyinstaller python脚本后没有模块命名错误 - no module named error after pyinstaller python script AttributeError: 在通过 Pyinstaller 将 python 脚本转换为 EXE 后 - AttributeError: After converting python script to EXE by Pyinstaller slackclient应用程序在PyInstaller构建后不起作用,但在python cmdline中工作正常 - slackclient app does not work after PyInstaller build but works fine from within python cmdline 如何使用 pyinstaller 从 python 脚本制作 a.exe? - How to make a .exe from python script with pyinstaller? 定期运行时,Python脚本运行良好,但使用PyInstaller编译时,效果不佳 - Python script works fine when run regularly, but not when compiled with PyInstaller 从 Pyinstaller 运行外部 Python 脚本 - Running external Python script from Pyinstaller py安装程序。 运行 &gt; pyinstaller myapp.spec 从脚本工作不同于从命令行 - PyInstaller. Run > pyinstaller myapp.spec from script works diffrent than from command line 使用 Pyinstaller 编译后,带有 Pyscreenshot 脚本的 Python Tkinter 不运行 - Python Tkinter with Pyscreenshot script doesn't run after compiling with Pyinstaller Python 使用 pyinstaller 创建 EXE 后将图像转换为视频的脚本出现问题 - Problem with Python Script that converts images to video after creating EXE with pyinstaller python 脚本在使用 pyinstaller 转换为 exe 后重复第一个命令 - python script repeats first command after converted to exe with pyinstaller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM