[英]Pyinstaller packaged app crashes on launch
I know this is a problem that's been asked here a bundle of times before, but I'm seriously at my wits end with this thing. 我知道这是一个问题,以前曾在这里被问过很多次,但是我很认真地对待这个问题。 I'm learning Python 3 and I decided I'd work on a little text based game. 我正在学习Python 3,因此决定要开发一款基于文本的小游戏。 I made some good progress, got most of a tutorial done, title card, half of a save file system written, etc. I decided, hey, I should try and see if I can package this thing before I go any further (because where's the fun in not showing your friends?). 我取得了一些不错的进步,完成了大部分教程,标题卡,一半的保存文件系统,等等。我决定,嘿,我应该尝试看看是否可以打包此东西,然后再继续(因为在哪里)不向您的朋友展示的乐趣?)。
I've used Pyinstaller before on some simple one file apps (dice rollers, etc.) and it worked flawlessly. 之前,我已经在一些简单的单文件应用程序(骰子滚轴等)上使用了Pyinstaller,它可以完美地工作。 However, I'm having a hell of a time with my larger game. 但是,我在玩大型游戏时遇到了麻烦。
When I bundle it with Pyinstaller it throws a ton of missing lib errors. 当我将其与Pyinstaller捆绑在一起时,会抛出大量缺少的lib错误。 I Googled around and those are apparently not a huge issue. 我在Google周围搜索,这些显然不是一个大问题。 Aside from that, everything seems to have run just fine... until I go to launch the program. 除此之外,一切似乎都运行良好……直到我启动该程序。 It's just a simple program that runs in the command line, but when I launch it it crashes immediately. 这只是一个在命令行中运行的简单程序,但是当我启动它时,它立即崩溃。
Now, I thought maybe this had to do with the modules I imported (or the fact that the program relies on calling from multiple .py files). 现在,我认为这可能与我导入的模块有关(或者该程序依赖于从多个.py文件进行调用的事实)。 So I made a smaller program that includes all the same imports and calls to an external file, and that one packaged and launched just fine! 因此,我制作了一个较小的程序,其中包含所有相同的导入和对外部文件的调用,并且打包并启动了该程序! So at this point, the working hypothesis is that there's something rightly messed with my code, but I can't for the life of me figure out what it is. 因此,在这一点上,可行的假设是我的代码中有些东西是正确的,但是我无法终生弄清楚它是什么。
Here's a link to the program itself: https://www.dropbox.com/s/ouog4ccbibpibgx/AsciiLand.zip?dl=0 这是程序本身的链接: https : //www.dropbox.com/s/ouog4ccbibpibgx/AsciiLand.zip?dl=0
Seriously, I've been at this all day and I've made exactly zero progress. 认真地说,我整整一天都在工作,而我取得的进展恰恰是零。 Any help would be greatly appreciated here guys. 任何帮助将在这里非常感谢你们。
Seems like I found the problem. 好像我发现了问题。 While it honestly just raises more problems, I'm gonna accept it for now. 老实说这只会带来更多问题,但现在我要接受。
Looks like Pyinstaller has some serious issues with PyFiglet. 看起来Pyinstaller的PyFiglet存在严重问题。 Everything compiled fine when I removed the PyFiglet output. 当我删除PyFiglet输出时,一切编译正常。 I have absolutely zero idea as to why, but oh well. 我对原因绝对不为零 ,但是哦。
For anyone in the future looking for answers to this, here's the command for compiling. 对于将来寻求解决方案的任何人,这里是编译命令。 You just need to add the Pyfiglet fonts directory to pyinstaller. 您只需要将Pyfiglet字体目录添加到pyinstaller。
pyinstaller --add-data "C:/Python36/Lib/site-packages/pyfiglet";./pyfiglet --onefile myprogram.py pyinstaller --add-data“ C:/ Python36 / Lib / site-packages / pyfiglet”; ./ pyfiglet --onefile myprogram.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.