Problems with Pyinstaller packaging paddle

Table of contents

problem solving

       1. Find the packages you need for your project

         2. Use the [auto-py-to-exe] library to add the package corresponding to the corresponding project

                --add-data files to add

                 --hidden-import files to add

source of problem

problem solving ideas


problem solving

       1. Find the packages you need for your project

        Here you can refer to another article by the blogger, and it is also recommended to read here first to find the package you need.

https://blog.csdn.net/gongzairen/article/details/131169142

        For the projects I use, I find the packages that need to be manually imported step by step, and finally organize them as follows

These packages can be found in your own virtual environment 

        

        

       

         2. Use the [auto-py-to-exe] library to add the package corresponding to the corresponding project

                --add-data files to add

        

         Many of these files are actually third libraries , but because they are packaged directly using pyinstaller, they are not complete enough. Although this library has been packaged, the dynamically imported library is still not imported, so the entire library is directly packaged as an additional file here. . Although this is not good, it will also cause the packaged file to be too large, but it is very effective. If you know exactly the specific files required by the project, you can choose the specific file package to save space.

                 --hidden-import files to add

        

 Finally, it is enough to generate the packaging file. So far, the packaging problem of the paddle project has been solved. This problem has troubled me for a long time. I found many articles on the Internet, read the explanations of many big guys, and finally figured it out by myself. I think it is helpful to the blogger. give a like.

The needs on the Internet are the methods summed up by others. You need to work hard on your own, and you have to constantly explore on your own. Let me make some conclusions about this problem.

source of problem

        Since Pyinstaller cannot fully intelligently load third-party libraries, and the paddle project dynamically loads a lot of third-party libraries, so after directly using pyinstaller to package, the module will not be found.

problem solving ideas

        The project of using pyinstaller to package paddle needs to continuously specify the third-party library, use --add-data and --hidden-import, run the exe file, there will be an error that the module cannot be found, and you need to specify the import of each library, which needs to be constantly Try to find all the libraries, one last import

       

Guess you like

Origin blog.csdn.net/gongzairen/article/details/131132968