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
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 "="
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.
this is because he did not copy a dependency.I solved it like this.
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 --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
Adding the line:
import pkg_resources.py2_warn
to my code helped.
same problem here:
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