PyInstaller .exe文件不执行任何操作 [英] PyInstaller .exe file does nothing
问题描述
三天后,我无法将python程序打包到.exe文件中.我已经尝试过py2exe(连续丢失模块)和PyInstaller.
After 3 days, I can't get a python program packaged into a .exe file. I've tried py2exe (which continuously missed modules), and PyInstaller.
这是复杂的部分.我的程序使用了许多其他已安装的模块(coopr,pyomo,openpyxl,glpk,cbc,pyutilib,numpy等).这些反过来又会导入其他各种东西,而我无法对其进行追踪(PyInstaller警告日志列出了676行缺少或可能不需要的模块.)
Here's the complicated part. My program uses a lot of additional installed modules (coopr, pyomo, openpyxl, glpk, cbc, pyutilib, numpy, etc.). These in turn import all kinds of other things, and I can't track it down (the PyInstaller warning log lists 676 lines of missing or potentially unneeded modules.)
但是,我已经(通过向程序中添加缺失的"模块的导入)获得了一个.exe版本,该版本可以通过双击或从命令行运行,而不会打印任何错误.
However, I've gotten (by adding imports of "missing" modules to my program) a .exe version which runs from double clicking or from the command line, without printing any error.
问题是,程序什么都不做.我有一个输入文件,该文件包含在内部版本中,程序会读取该文件,进行一些(大量)计算,然后在同一目录中创建一个.csv输出文件.它用作.py文件.我的.exe不执行任何操作.
The problem is, the program does nothing. I have an input file which is included in the build, which my program reads in, does some (intense) calculations, and then creates a .csv output file in the same directory. It works as a .py file. My .exe does nothing.
因此,如果您能告诉我出什么问题了,请继续.如果没有,我想知道任何有用的步骤或想法.至此,我已经穷尽了从程序和文档中可以找到的反馈.
So, if you can tell me what's wrong go ahead. If not, I'd like to know any helpful steps or ideas to try. At this point, I've exhausted the feedback I can find from the program and documentation.
推荐答案
我只是为自己解决了这个问题.
I just solved this problem for myself.
请确保您没有与要转换为可执行文件的脚本同名的文件夹.
Make sure you do not have a folder with the same name as the script you are trying to turn into an executable.
这篇关于PyInstaller .exe文件不执行任何操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!