简体   繁体   English

pyinstaller:应用程序不会在其他计算机上运行?

[英]pyinstaller: app won't run on other computers?

I used PyInstaller to successfully turn a very basic python program (that prints a few things to the console) into a one file executable on my MacBook Pro:我使用 PyInstaller 成功地将一个非常基本的 python 程序(将一些内容打印到控制台)转换为我的 MacBook Pro 上的一个可执行文件:

名为 <code>Test_App</code> 的捆绑应用程序

Everything works fine when I run it on my computer.当我在我的电脑上运行它时,一切正常。 When I send it to friends, however, it doesn't run.但是,当我将其发送给朋友时,它不会运行。 I've tried sending through email/google drive (in which it turns into a TextEdit Document) and sending it through Facebook (in which it turns into a .jpg file).我试过通过电子邮件/谷歌驱动器发送(在其中它变成一个 TextEdit 文档)并通过 Facebook 发送(在它变成一个 .jpg 文件)。

I read here that no file extension means the system has no idea what application to use to open the program.在这里读到没有文件扩展名意味着系统不知道使用什么应用程序来打开程序。 So I have a few questions:所以我有几个问题:

  1. What file extension(s) do I need to give this to get it to run?我需要给它什么文件扩展名才能运行它?
  2. Will PyInstaller ever give a mac program a file extension? PyInstaller 会给 mac 程序一个文件扩展名吗? (I've noticed on Windows it gives it the .exe extension it needs) (我注意到在 Windows 上它给了它它需要的.exe扩展名)

If you archive the file into a zip archive, for example, it should preserve the executable properties.例如,如果您将文件存档到 zip 存档中,它应该保留可执行属性。

Most Emails (and maybe Facebook) use virus scanners on any file uploads and are able to deny/rewrite your file so that it isn't seen as potentially harmful大多数电子邮件(可能还有 Facebook)对任何文件上传使用病毒扫描程序,并且能够拒绝/重写您的文件,使其不会被视为具有潜在危害

I have also met this question and I just use cv2 to read the image.我也遇到过这个问题,我只是使用 cv2 来读取图像。 The program works well on my computer and did not work on other machines.该程序在我的电脑上运行良好,在其他机器上无法运行。 No error message has been shown.没有显示错误消息。 Later I found that cv2 can not read an image from the path which has Chinese characters.后来我发现cv2无法从有汉字的路径中读取图像。 In my computer image path don't have Chinese characters.在我的电脑图像路径中没有汉字。 However, in other machine image path have Chinese characters.但是,在其他机器的镜像路径中有汉字。 After reading the image, if it is None, I just return from the function, which leads to no error message and the program was not running in the right way.读取图像后,如果它是None,我只是从函数中返回,这导致没有错误消息并且程序没有以正确的方式运行。

To sum up, if this happens to you and no error messages pop, you should think about the difference between the two machines' environments(file path, external file, os setting...) and check your program.综上所述,如果您遇到这种情况并且没有弹出错误消息,您应该考虑两台机器的环境之间的差异(文件路径,外部文件,操作系统设置...)并检查您的程序。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM