简体   繁体   中英

Pyinstaller not converting .py to .exe because lib not found

I cannot convert a python file into an executable with pyinstaller because, when I try to convert it, the following errors are returned:

4116 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\myname\appdata\local\programs\python\python37-32\VCRUNTIME140.dll
4173 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\myname\appdata\local\programs\python\python37-32\VCRUNTIME140.dll
4394 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of c:\users\myname\appdata\local\programs\python\python37-32\python37.dll
4465 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\users\myname\appdata\local\programs\python\python37-32\python37.dll
5291 WARNING: lib not found: api-ms-win-core-namedpipe-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll
5312 WARNING: lib not found: api-ms-win-core-rtlsupport-l1-1-0.dll dependency of C:\WINDOWS\system32\ucrtbase.dll

actually there are many more than these 4 but they are all sharing the common problem of lib not found: api-ms-win-crt

The python program manages an excel file and then generates an email through outlook. Packages used by the program are Tkinter, Openpyxl and win32com.client, but only the last one is (I think) the one giving problems. What can I do to convert it properly? Thank you for your help

If you are creating the exe on win 10 then those library's don't really matter because of the way win 10 works. If you create it on win 10 though you won't be able to use it on Win 7 without those DLL's.

If you want the DLL's for it to work on win 7 then you need to copy the DLLs from microsoft runtime visual c++ 2015 into the python DLL folder usually located at C:\\Users\\"user"\\AppData\\Local\\Programs\\Python\\Python36\\DLLs .

To properly create the exe all you need to do is hold Shift, right click within the folder where your .py is and open a CMD window within this folder. Run this command with your .py name.

pyinstaller --clean --noconsole -F "".py

You should get a few folders and your exe will be located in the dist folder.

Let me know if you have any questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM