cannot start python newly made exe - python

I've written a GUI "app" with Python Tkinter and everything is working great. Then I used pyinstaller to make an EXE file out of it - again success. But when i try to run my app on another PC, nothing happens. No error, nothing. I've tried building a single EXE file using the --onefile option; I've tried not putting it all in one file --> on my machine it's working, on the otherS - not. I even copied the msvcr90.dll file and put it in the same directory as the executable - no success. Any ideas?

Related

Failed to execute python script built using PyInstaller (ModuleNotFoundError)

I am trying to turn a .py file into .exe so that it's runnable on other computers without python. I followed this tutorial, installed pyinstaller then ran the command pyinstaller --onefile IRV.py without the -w since my program runs in the console. It successfully built the .exe file but when I run it it immediately closes even though the program itself asks for input at the beginning. It uses a bunch of .txt and .xslx files from the folder of the .py file so I dragged the .exe out of the dist folder but it still gives the same error. I managed to make a quick print screen before it closes and it gives me this error: https://imgur.com/a/w7TVjaN
The script doesn't even work if I double click the .py file. However it runs perfectly fine if I open up the .py file in an IDE like Spyder. When I run the .exe file it opens up the cmd for a few seconds with nothing written on it and then quickly writes that error I managed to screenshot and then closes. If I double click the .py though it instantly closes without the wait or the error message.
Pyinstaller didn't find the libraries or modules you imported. In the build folder that was deleted in the tutorial, there's a text document that shows warnings for libraries that aren't found by the pyinstaller. You may need to check that.
This Q&A mentioned a problem that is related to your Question: No module error when running python script from command prompt

My exe created with pyinstaller flashes and terminates

I have written small code in python for data scraping using selenium, and BeautifulSoup.
The code is working great in pyCharm but when I convert my file from .py to EXE using pyinstaller example.py command, it converts correctly but the EXE file flashes and terminates and the code doesn't execute.
This is the result of the pyinstaller command:
This happens when there is an error being faced by the python script. Try running the .py module file in IDLE or by simple double clicking the .py .
I guess pyCharm creates a virtual environment which might be causing the issue.
Maybe try adding try/except for the code so that it doesn't flick away, rather shows the error.

pyinstaller compiled .exe does nothing

Wrote a game and compiled it with pyinstaller. An EXE file was created but when I go to run it, it thinks for 3-4 seconds and then it returns to command prompt.
Clicking from the folder in Windows does nothing.
No errors, nothing! Do I need something in my code to allow this to run? The only imports are tkinter and random.
Edit 1: tested a "hello world" script to see if there were issues with pyinstaller, it ran fine.
I understand that the post is older, but it may be useful for other member who may come across the similar problem.
I had created a script using Jupiter notebook and it creates ipynb file.
When I create an exe file using pyinstaller, the exe was doing nothing.
I resolved it by first converting ipynb file to py file using below command:
pyinstaller my_script.py
It will create the py file under same location.
Now, execute below command to create exe file:
pyinstaller my_script.py
It will create exe file under dist folder.
And it works.

How to package multiple Python files into an .exe

I am a total noob when it comes to this, but I have been tasked to package several Python files into one .exe file.
I tried doing this with PyInstaller and I realized that I wasn't able to import opencv at first. Sure enough, I pasted a copy of cv2.pyd into the site packages folder and that was corrected. I tried building it again but it still doesn't work.
The command I use is: pyinstaller --onedir C:\Users\ -- Directory of Python file The file I'm using is the main one, that makes the program run. I thought PyInstaller would have scanned this file and find the other imported files.
I'm not sure how to add the other files. The documentation on the PyInstaller website isn't super clear to me.
More Info: Application consists of a GUI with 5 Python files in total
Application packages but doesn't run (Command Window blips and goes away)
Any suggestions?
Thanks a million - Matt

Pyinstaller exe single file executable on different computer

I am trying to make a gui to control a spectrum analyzer. The code works when running from the IDE. I generate an .exe unsing pyinstaller with the code.pyinstaller.exe --onefile --windowed --icon=spec.ico spectrum_analyzer_gui.py The .exe works great on the computer that generated it.
I tried to run the .exe on a different computer but got an error 'Failed to execute script spectrum_analyzer_gui'
I copied the icon to the same location.
What else do I need to do so the application runs on a different machine?
I have attached a like to a .zip in dropbox with the source code and build.
https://www.dropbox.com/s/87uqynllnlv72c4/Spectrum%20Analyzer%20Gui.zip?dl=0
Try adding a --hidden-import=tkinter to your exe generation.

Categories

Resources