Pyinstall package py script warning: lib not found and other related issues

Detailed map traversal, teach you to master the complex gremlin query debugging method>>>

Since pyinnstaller was used to package py as an EXE file, xiaocrawler has always encountered problems such as warning: lib not found

Although most of the time, you ignore these warnings like me, the packaged exe can also run. There are a lot of methods on the Internet. Some suggest installing win7, others suggest changing 32-bit Python files, and there are prompts to download 2G related SDKs. In a word, pyinstaler is not friendly enough to the current win10 support! But the cost of these methods on the Internet is too high, so how to use pyinstaler gracefully without full screen warning prompt without changing win10 x64 system and python Version (3.6.4)

After some groping, I finally found a way. Pyinstaller prompts that these DLL files that can’t be found, such as api-ms-win-crt-runtime-l1-1-0.dll, actually exist in win10 system, most of them are in the path of C: (Windows/system32) Downlevel and its upper path of C: (Windows/system32 , as shown in the following figure:

We just need to add these two paths to the user environment variables

After adding environment variables, when pyinstaller packages py files, it will first search these paths, and then it can package successfully PS: remember to log off the system and log in again before it takes effect

Package again, the page is much more refreshing, win10 x64 pro test effective

PS: it should be noted that although our pyinstaller package py file often shows “ success “, when we run the EXE file, we still report an error, such as fail to execute script. The terminal interface often flashes by, and we can’t even see the specific reason with our naked eyes for many times! There is a stupid way to climb – record screen . Recommend an easy to use screen recording software OCAM. The prompt information that seems to flash by the naked eye will be completely recorded by the screen recording software to form an MP4 file. With the help of the pause function of the player, we can locate the error information. Here are some of the errors I encountered during execution:

At this time, the problem is simple. For example, the above two figures indicate that one cannot find the module distuils, and the other indicates that the dependency library xlrd needs to be installed. We can find the distuils folder from the Lib file corresponding to the location of the python file and put it in the folder corresponding to our python (Env), while xlrd can be installed directly with PIP

PS: if you want to package a py file that references the panda library as I do, you should not directly Import panda as PD in the program as far as possible. In this way, the packaged EXE file is very large, and you can refer to any function you use, such as:

from pandas import read_ csv,read_ excel,DataFrame,concat

If you have this kind of trouble when using pyinstaller, please try my method again

Similar Posts: