Python encapsulates exe with pyinstaller. Solution to crazy flash back after double clicking


Here we need to analyze the problem of error reporting and flash back. How to view the problem:

Use the screenshot tool or QQ screenshot shortcut key to grab the contents in the flash back of the CMD window to view the problem.

Most of them are caused by the lack of module packages. What I want to say here is to add input and os System (“pause”) and add.\**** Exe is useless. If your code really doesn’t have input, it really needs to be added. Even if you do not add a slow process that can actually execute code in the CMD command window, it will not flash back.

Solution to flash back:

1. use the screenshot of QQ shortcut key to get the code of exe in CMD flash back.

2. after the screenshot is completed, save the screenshot to the desktop to facilitate subsequent careful review of the problem

3. open the screenshot to view the problem. If you don’t understand the code prompt, you can translate it to Baidu. You can mainly look at the command prompt behind English such as error

I take my flashback problem as an example:

The following figure is obtained by using QQ screenshot

 Python encapsulates exe with pyinstaller. Solution to crazy flash back after double clicking

The main reason for the above analysis is [see the prompt after error]: no module named “Pandas” —- >Missing module with name pandas

At this time, we found that pandas has been installed on the compiler pycharm.

Python encapsulates exe with pyinstaller. Solution to crazy flash back after double clicking

main cause:Pycharm and idle are two Python compilers. When you install the module package, you install it through the pycharm compiler. By default, the module package is under the venv file of the project. There is no pandas module package in the idle compiler. As a result, when you use pyinstaller to package exe in idle (CMD command mode), there will be a lack of modules, and no error will be reported during the packaging, because the packaging does not detect whether your program can be executed, but simply packages it, which is similar to a compressed file. However, after the package is completed, the command will be executed when double clicking the EXE program, which will prompt that the module package is not recognized, resulting in flash back. If you run pyinstaller in the idle command mode and an error is reported, you will be prompted that there is no such command. The same is true. Pyinstaller needs to be installed at idle. The command is PIP install pyinstaller

Therefore, we should install the module package in the idle mode before the idle encapsulation, and execute the following commands:

pip install pandas

Solve the problem of exe flash back perfectly!

If you need to install pycharm’s module package at idle, you need to specify the installation path [Lu Jin creates * * * \venv\lib\site-packages\ under the project file for pycharm], for example:

pip install --target=D: \python office automation \venv\lib\site-packages pyinstaller

This is the end of this article about the solution of crazy double-click flash back of Python encapsulated exe with pyinstaller. For more information about double-click flash back of Python encapsulated exe with pyinstaller, please search the previous articles of developeppaper or continue to browse the related articles below. I hope you will support developeppaper more in the future!