I tried to convert my python gui application (.py ) to an executable file(.exe) using the pyinstaller module. I ran the following command in the terminal -
pyinstaller.exe --onefile -w sourcecode.py
The process was completed successfully and I got the .exe file(sourcecode.exe) along with the extra folders like pycache and sourcecode. But when I tried to run the .exe file/application by double clicking on it the app didn't start up and gave an error. Please help.
Try adding this --hidden-import to pyinstaller.exe --onefile -w sourcecode.py in case of hidden modules.
You can also try adding --debug to see what the error actually is.
Related
My script .py work perfectly, but .exe sadly doesn't work. Im running on newest PyInstaller.
Here is my script
I already tried everyting that i can think of here is options that i used:
Options used
-w : does't have .exe file
-- onefile -w and -F -w : The specified module could not be found.
--F , --onefile and no option used : Only shows this option for like half a second
Not all python code can be compiled into a .exe.
I was able to work around this issue by importing pywintypes into my script before win32print module.
for some reason i cant run a program that i have "compiled" using Pyinstaller.
I have used the following command to make the exe file:
pyinstaller -F logFileHandler.py
I have also tried:
pyinstaller -F --onefile --windowed logFileHandler.py
but that did not work either.
As i understand the -F and --onefile is more or less the same?
The error i get when i try to run the program is:
As far as i can see the problem is with Pandasgui
and it is looking for some weird theme..
I have two Python scripts which produces a GUI and runs code off some of the buttons. When run from Python, I run mainImpactTool.py which then runs impactTool.py to produce the GUI.
mainImpactTool.py
impactTool.py
I followed the guidance here:
https://pythonhosted.org/PyInstaller/usage.html#what-to-bundle-where-to-search
So I could create a single executable for running on Windows.
If I had one script I would normally run:
Pyinstaller --onefile mainImpactTool.py
However, to use two scripts, I did this:
Pyinstaller --onefile mainImpactTool.py impactTool.py
Pyinstaller works, but when I run the .exe file I get the error:
ImportError ... Failed to execute script mainImpactTool
Any suggestions on what I am doing wrong?
Thank you
Pyinstaller --onefile mainImpactTool.py
Try this it will work. Pyinstaller will recurse over all your imports(impactTool.py) and include it in the .exe.
I have coded a program in Python 3.5 that uses the Tkinter import. I'm trying to figure out a way to run it on computers that don't have Python. First I tried freezing it but I haven't been able to because none of the freezing tools I found support Python 3.5. Then I tried possibly using a online idle but I couldn't find any that support Tkinter. I would prefer to be able to get a .exe file or something similar but if I could run it online that would be good too any ideas?
EDIT
So I have now successfully downloaded PyInstaller using pip. My current problem is when I type this into the console: pyinstaller.exe --onefile --windowed Finder.py
I get this error: 'pyinstaller.exe' is not recognized as an internal or external command,
operable program or batch file.
EDIT
I have now found the pathway to pyinstaller.exe. Now when I try to use it it says Access is denied.
I finally figured it out after about three days of work. Fist I downloaded PyInstaleller in the zipped form and extracted it. Then I put my program in the PyInstaller folder. Then I opened a regular command prompt. I then typed cd then the location of the PyInstaller folder. Finally I typed pyinstaller.py --one file --windowed program.py. Then when I went into the PyInstaller folder there was a folder called program with the .exe file in the dist folder. Thanks everyone for all of your help!
You can use pyinstaller to do that. I think its work fine on linux em linux.
Another option is use py2exe.
Try pyinstaller -F -w Finder.py as the command or you could check out CxFreeze.
I have a Tkinter GUI battleship game application I wrote that I am trying to convert to a .app file so I can run it easily on Mac OS X computers. After cding to the directory with both the main .py file, and all the subfiles (three other python files, a json file, and an icon file), I am executing the following command:
pyinstaller --onefile --windowed --icon favicon.icns --name Battleship battleship.py
This produces two files in the "dist" folder: Battleship and Battleship.app. The Battleship.app has the icon I specified in the command above.
When I run the non .app file (via double-clicking it), a terminal window opens and my Tkinter GUI opens and works (from the little testing I did) flawlessly. However, I would like only the GUI to open, without the terminal.
This is supposedly the purpose of also producing the .app file. However, when I run the .app file (via double-clicking it), it's icon merely bounces a few times in my application bar at the bottom of my screen, and then disappears. No actual window is opened.
How do I make it so when I double-click the .app file, my application's GUI actually opens (without a terminal window)?
Thanks in advance.
Note: I am using Python 3.5.1
RoberR seems like you are missing some necessary packages while building app from pyInstaller, I would suggest your to use:
pyinstaller --onefile --icon favicon.icns --name Battleship battleship.py
it will display your terminal and you would be able to figure out what is happening, in case of missing package please use:
pyinstaller --onefile --hidden-imports=file_name --icon favicon.icns --name Battleship battleship.py
Hope this solves your problems.
It is definitely an issue with Tkinter that crash when using the doubleclick on the .app. The only workaround I found was to use "brew python3" instead of "anaconda python3".
Reposting myself from: https://stackoverflow.com/a/57818744/10143204
There is a few issues with the tcl version that comes with python, discussed here. I've written an script that automatically changes the init.tcl file to the correct version.
N.B. you shouldn't use the --onefile flag as the file directories aren't present, and the script won't work.
cd /path/of/your/app
git clone https://github.com/jacob-brown/TCLChanger.git
pyinstaller --windowed app.py
python TCLChanger/TCLChanger.py
You should now be able to open your app, from the terminal and via double clicking.