First, you need to install pyinstaller--using PIP to install the module (My Computer is a Python compilation environment Anaconda, if the computer is loaded with Python's IDE, it will go directly to the Python installation path, such as: "D:\ Python27\scripts\pip.exe ") My Anaconda2 installed on the G-disk so use the following path-EXECUTE statement: Pip.exe install pyinstallercmd into the Python installation directory (CD" G:\ Anaconda2\anaconda2\scripts ") Another benefit of using PIP installation is that PIP will automatically install the dependent modules required by this third-party package (for example, this helps us to download the Pypiwin32 dependency). Second, start cmd package the py file as exe file Pyinstaller folder is located in: G:\Anaconda2\Anaconda2\Lib\site-packages (if ANACONDA2 is not installed, only Python is loaded, Then Pyinstaller should be located in "Your installation directory \python27\lib\site-packages" ) (1) Create a new folder under the Site-packages folder Myexe is used to store the py file to be made EXE (2) command Prompt to enter the Myexe folder; (3) command prompt input: pyinstaller-f file name. py; Note the spaces and capitalization; For example Pyinstaller-f mytest.py "(4) within the folder will generate several files, where the EXE file is in the Dist folder. Third, the problems encountered and solutions: 1, the use of Pyinstaller packaging program error importerror:the ' packaging ' package is required; Normally this is a bundled with the "If you get" this warning, consult the packager of your distribution. WORKAROUND: Setu The version of the Ptools package is too high and the Setuptools version in the environment is 20.x.x. Decisively uninstall and install the lower version of Setuptools (19.2) as follows:
Pip Uninstall Setuptoolspip Install setuptools==19.2
2, but in the run pip uninstall setuptools times wrong, can not find "easy-install.pth" file, so the use of manual unloading way: To Python's third-party module or package storage location to manually delete files and folders, Then delete the corresponding line in the Easy-install.pth file. (The problem is that I'm installing Anaconda2, not just python, so the directory is not the same as the default directory, Uninstall method can not find easy-install.pth, because in Anaconda2, Steuptools installation information in a separate file called Setuptools.pth, Steuptools package and the setuptools.pth are deleted Off, you can.) Reference blog: Http://blog.csdn.net/kongxx/article/details/51037331http://blog.sina.com.cn/s/blog_ 4DDEF8F80102V1P8.HTML3, pip install Setuptools = = 19.2 Problem Resolution 4, during the course also encountered a package can not find a problem, online someone said that the missing package in the Py file import, Then go to the Python installation directory in the Site-package to find the corresponding package copied to the Pyinstaller file in the same directory, but I later found that if the way to install Pyinstaller Pip is not the problem. Reference: Http://jingyan.baidu.com/article/a378c960b47034b3282830bb.htmlhttp://blog.csdn.net/churximi/article/details /50321853http://blog.csdn.net/kongxx/article/details/51037331
Python's py file is packaged as EXE