Solution to the problem that the exe packaged by python pyinstaller cannot run in win7 system

Table of contents

1. The cause of the problem

2. Solution

Note: Before pyinstaller is packaged, please delete the bulid folder and dist folder. These two folders are automatically generated after pyinstaller is packaged. Deleting and repackaging can avoid version interference.


1. The cause of the problem

        Recently, I did a source code project (the development tool uses pycharm2023.1.3). Since it runs in the windows environment, I used pyinstaller to package it into exe.

        The test on the local machine is normal, but it is sent to the customer's computer and the feedback cannot be run. The customer's computer system is the ultimate version of win7.

        We check the release notes on the python official website, and send the following version nodes:

        That is to say, win7 supports up to python3.8.10

2. Solution

        Install python3.8.10, repackage the project, note that when packaging, the instructions need to specify that the current virtual environment is 3.8.10

as follows:

pyinstaller --paths D:\py_prj\ali_kufang --paths D:\py_prj\ali_kufang\vue\Lib\site-packages -F server_Ku.py

D:\py_prj\ali_kufang\vue\Lib\site-packages is my current virtual environment directory. When pyinstaller packaged it, I also wrote it into the packaging instruction.

At the same time, check the python version of the virtual environment. There is a pyvenv.cfg file in the vue directory of the project. This file has a home, which records the current python packaged version.

Note: Before pyinstaller is packaged, please delete the bulid folder and dist folder. These two folders are automatically generated after pyinstaller is packaged. Deleting and repackaging can avoid version interference.

 

Guess you like

Origin blog.csdn.net/fyq158797/article/details/131674567