pyinstaller packaged exe executable file, the module can not find solutions to problems

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_44297303/article/details/99059299

After using pyinstaller of python program packaged, if a call to self module packed the main program (sometimes third-party modules will also appear the same problem), run the exe file problem module could not be found
after opening the exe file output the following error:
ModuleNotFoundError: No module named ‘pygame’

solution:
pyinstaller -F test .py -p. \ Venv \ Lib \ Site-Packages Standard Package

  • I pygame module stored in the project \ venv \ Lib \ site-packages directory
  • -F: directly generate separate exe file not included various dependencies.
  • -p: closely followed you to specify the module search path, if your module installation path is not PyInstaller automatically retrieved, you can specify your own.

After regenerate the exe file, you can run, the problem is solved!

Guess you like

Origin blog.csdn.net/weixin_44297303/article/details/99059299