Recently, I was asked how to package python as an EXE program. pyinstaller3.3 is installed using PIP install Pyinstaller. I found a tutorial on the Internet, packaged the program as an EXE file, but there was a failed to execute XXX error while executing the file. Later found that should be in the program to refer to the picture and other paths out of error, while in the packaged EXE file path should also be placed under the referenced image. Close-up this article, for students who encounter this problem reference.
Found in the code, the path of the ICO icon is an absolute path, this time I suddenly understand, will not be, pyinstaller in the packaging when the ICO pack in, generate EXE file sent to others, and then this path can not be found, and then the program began to error! With hope, quickly change the path to a relative path!
Running ok! in the IDE No problem, you can open it and start using Pyinstaller to package the build exe!
After a while in the directory generated disc folder, there is a good exe file generated, God bless, must be successful. After running ... I'm a man! Error, haha and before the error is identical, no problem! After generating the EXE has not been copied in the ICO folder, relative path must not find Ah! The ICO file is copied in the previous relative path below! Then run, ok! Perfect execution!
How the python3.x program is packaged as an EXE executable file