Pyinstaller “Failed to execute script pyi_rth_pkgres” and missing packages

后端 未结 8 512
旧时难觅i
旧时难觅i 2020-11-29 03:54

This is my first time posting a question here as most of my questions have already been answered by someone else! I am working on a GUI application in python and am attempt

相关标签:
8条回答
  • 2020-11-29 04:26

    Extending Vikash Kumar's answer, build the application by adding the --hidden-import argument to the command.

    For example, running the command given below worked for me.

    "pyinstaller --hidden-import=pkg_resources.py2_warn example.py"

    update: added missing "="

    0 讨论(0)
  • 2020-11-29 04:33

    I extend @vikash-kumar answer.
    pyinstaller tool has command line parameter --hidden-import.

    It resolves the topic problem for me.

    More information:
    https://web.archive.org/web/20200601130821/https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html#listing-hidden-imports.

    0 讨论(0)
  • 2020-11-29 04:33

    this is because he did not copy a dependency.I solved it like this.

    • pyinstaller my_program.py

    this creates a my_program.spec. it is a base configuration file.

    open it with any text editor. search for

    hiddenimports=[]

    edit to.

    hiddenimports=["pkg_resources.py2_warn"]

    now let's call pyinstaller passing our configured file instead of our program

    • pyinstaller my_program.spec
    0 讨论(0)
  • 2020-11-29 04:35
    pyinstaller --hidden-import=pkg_resources.py2_warn --onefile example.py
    

    you can use this really it works no need to install or uninstall anything just use this it will create one file only , below code will not create the black window also if you are creating a Tkinter application mainly

     pyinstaller --hidden-import=pkg_resources.py2_warn --onefile --noconsole example.py
    
    0 讨论(0)
  • 2020-11-29 04:36

    Adding the line:

    import pkg_resources.py2_warn
    

    to my code helped.

    0 讨论(0)
  • 2020-11-29 04:44

    same problem here:

    • OS: Win10
    • Python: 3.7
      • pyinstaller installed by pip install pyinstaller

    fix by (same solution with above, by no need download):

    pip uninstall pyinstaller
    pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
    
    0 讨论(0)
提交回复
热议问题