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
Related
I'm trying to covert a python tkinder gui into an executable for my collogues with pyinstaller. The console output states that it always runs successfully however when I try to open the .exe I get an error message saying
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access them.
I can't find anything online that has been helpful and I'm hoping someone might be able to give me a useful hint here.
My initial run is with pyinstaller my_script.py --onefile --windowed and after the spec is created I'll update the datas array to include a .json file that is needed for the script in the form of datas=[('my_json.json', '.')], (it lives in the same folder as the python script). After all this I'll rerun pyinstaller as pyinstaller my_script.spec. But still no luck.
I've notice that in other forums when people post their console output there's a line that states:
3780 INFO: Updating manifest in C:\Users\PATH_TO_THEIR_SCRIPT\dist\their_script.exe
Where as mine states:
3780 INFO: Updating manifest in C:\Users\PATH_TO_MY_SCRIPT\dist\my_script.exe.notanexecutable
Why does mine have the "notanexecutable" appended?
I made "exe" file using pyinstaller .
(command in cmd window : pyinstaller -w -F test.py and using many command)
It worked fine when I ran it before, but since I started writing a new Python file,
The "exe" file have problems.
files are generated well, but when I run this "exe" program.
error window pop up like this : python failed to execute script test.py
I looked for this problem all the web, but I couldn't find how to fix it
i'm using PYQT5 gui program, but there is no image
and
3.6.1 versino python 32bit
if you add new changes, try to delete the files generated on your first run of creating the .exe and try again with a clean folder structure
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.
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.
I wrote a program in Python that includes external files, including images and a GUI .ui file.
I want to convert the Python script to a single executable (.exe) file using PyInstaller. When I try to open the .exe file, the program does not open.
You will need more information on why the application is closing immediately in order to solve your problem. To view the error messages associated with running your executable, run the .exe file from the command prompt: /path/to/app/dist/MyApp.exe. This will allow you to observe any errors that may exist after the app was bundled. If the program fails during an import statement, you may need to add a package to the hiddenimports list in the .spec file. Check the PyInstaller documentation for instructions on modifying the .spec file.