Python EXE run failure due to missing DLL's

Viewed 4375

Good day, everyone!

I made a python script in my Windows 10 laptop that exports sql data into text file. The script was compiled into an executable file via the pyinstaller python package. The exe runs perfectly on my laptop with no issues. However, when I copy/pasted the directory of the exe files in to another laptop (with Windows 7 OS) and run it, errors occur. So, I tried to install python and all the packages I've installed in my laptop to run the script. Yet, the errors remain. Please check the ss of the errors below.

When I run the exe file this pops up enter image description here

If I click OK, two pop ups appear with the same content enter image description here

To tell you the truth, this is my first time writing a python script so I may be missing some important details. Please, do explain to me how I can fix these errors. Thank you in advance!

[UPDATE] I tried to copy/paste the raw python script (pyw) and compiled it to exe on the Windows 7 laptop itself. The error being shown this time when I run the new exe file is "Failed to execute script transfer_out_exporting". No other details are given.

2 Answers

Problem Solved

First, I copied the raw python file (pyw) and compiled it on the Windows 7 laptop itself. This solved the api-ms-win-core dll and python dll issues. Then, I added the read and write files that the exe uses for some data referencing.

The exe was running after doing those steps. I think I was overthinking the problem when I simply had to look at my script. Make sure to always check your script!

Python 3.9 does not seem to be supported on Windows 7 anymore. At least Python 3.7 works on Windows 7 (I don't know about Python 3.8). So, you could compile the program on e.g. Windows 10 within an (anaconda) environment using Python 3.7 and pyinstaller and the resulting compiled program should work on Windows 7.

Related