Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem that python encapsulates exe with pyinstaller and flashes back crazily after double click

Shulou Source: shulou.com Published: 2022-06-02 17:58:01 10月04日 Update

This article mainly explains "how to solve the problem that python encapsulates exe with pyinstaller after double-click", the content in the article is simple and clear, easy to learn and understand, please follow Xiaobian's train of thought slowly in depth, together to study and learn "how to solve python package exe with pyinstaller double-click after crazy flicker" bar!

Here we need to analyze the problem report error flashback problem, how to view the problem:

Use the screenshot tool or the QQ screenshot shortcut to capture the contents of the cmd window's flashback and view the problem.

Most of this is due to the lack of module packages. What I want to say here is that it is useless to add input and os.system ("pause") on the Internet and to add.\ * *. Exe in the cmd command mode, if your code really does not have input, it is necessary to add it. Even if you don't add it, you can actually execute the code in the CMD command window, but it doesn't flicker.

Flashback solution:

1. Use the QQ shortcut to take a screenshot of the exe code in cmd flashback.

two。 After the screenshot is finished, save the screenshot to the desktop to facilitate the subsequent careful review of the problem.

3. Open the screenshot to view the problem. If you don't understand the code prompts, you can translate them into Baidu, mainly looking at command prompts such as error.

Let me take my flicker problem as an example:

The following picture is captured by using QQ screenshot.

The main reason for analyzing the above is [see the hint after error]: No module named "pandas"-> missing the name pandas module

At this time, we found that the compiler pycharm was obviously installed with pandas.

Main reason: pycharm and IDLE are two python compilers, when you install the module package, it is installed through the pycharm compiler, the module package is under the project venv file by default. There is no pandas module package in the IDLE compiler. It will cause you to lack modules when encapsulating exe with pyinstaller in IDLE (CMD command mode), and there is no error in the encapsulation, because the encapsulation does not detect whether your program can be executed, but simply packages it, similar to a compressed file. But after encapsulation, double-clicking on the exe program will execute the command, prompting that the module package is not recognized, causing it to flicker. If you execute a pyinstaller error in IDLE command mode, you are prompted that there is no such command, and the same is true. Need to install the pyinstaller command on IDLE is pip install pyinstaller

So we need to install the module package in IDLE mode before IDLE encapsulation, and execute the following command:

Pip install pandas

The perfect solution to the exe flashback problem!

If you need to install the module package of pycharm in IDLE, you need to specify the installation path [* *\ venv\ Lib\ site-packages\ under the project file created by Lu Jin for pycharm], for example:

Pip install-target=D:\ python Office Automation\ venv\ Lib\ site-packages pyinstaller Thank you for your reading, the above is "how to solve the problem of crazy flashback after double-click of python encapsulated with pyinstaller exe". After the study of this article, I believe you have a deeper understanding of how to solve the problem of crazy flashback after double-click of python encapsulated exe with pyinstaller, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Encapsulation commands modules problems screenshots time prompts madness patterns compilers compilers code content files learning reasons shortcuts programs projects analysis Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi MySQL Microsoft Shulou Information