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
Related
If this is happening to you, the error (In this case) is a broken installation of pyinstaller or python, remove it from the computer and do a fresh reinstallation.
When trying to create a exe with pyinstaller, it works fine and the bundled .dll file is included an it unpacks the _MEI folder with the necesarry files the correct places. BUT i creates one called _MEIxxx but tries to open a _MEIxxY which does not exist (yes, both changes name everytime it is launched)
I cannot see anywhere you can manually set the name of the _MEI folder which would make it much easier.
The cmd command i am running is:
pyinstaller script.py --add-data "PATH TO DLL\python39.dll;test" -F --runtime-tmpdir .
reproducible problem:
creating a fresh .py project with python 3.9(i use pycharm)
include code of:
print("HI")
then in cmd use:
pyinstaller main.py -F (we want it to be a onefile exe)
Then the .exe file is copied to another pc
Here we run it with CMD to see the error output.
It returns the error:
Error loading Python DLL: "path to local\Temp\_MEIXXXX\python39.dll
the error (In this case) is a broken installation of pyinstaller or python, remove it from the computer and do a fresh reinstallation.
I'm create a exe file with pyinstaller.I'm create with this command:
pyinstaller --onefile mybot.py
It's worked without showing any error. But I want without console so I'm used this command:
pyinstaller --onefile -w mybot.py
Now It's showing error on a popup: failed to execute script mybot
How can I solve the problem?
Your script had module run on console like os,... You may need to replace those module to another windowed module to support windowed executable
EDIT: You can use subprocess.Popen instead of os
I was facing a similar problem earlier. I was using PHPMyAdmin to store the database files. This is what worked for me. I stored the Database(sql) file in the same folder as the python file and changed the library I was using for accessing the sql file.
Then it worked perfectly for me. I think you need to make sure that all the files are in the same folder.
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
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'm trying to use pyinstaller with python version 2.7 to make a standalone file that will run a small app I made using tkinter, but I'm having trouble following the documentation. I found this, but it's for python 2.5 and windows
http://www.pyinstaller.org/export/v2.0/project/doc/Manual.html?format=raw#spec-files
I made two folders on my desktop, one for pyinstaller and one containing my files.
In terminal I changed the directory to the pyinstaller folder. Then I typed the following:
python pyinstaller.py /Users/.../Desktop/BuildFolder/menu.py
//buildfolder contains my files, menu.py is the file I run to start the app
When this runs, I get a message staing something along the lines of "The output directory and all of its contents will be removed. Proceed y/n?" Upon selecing yes, It then creates the directory
/Users/.../Desktop/pyinstaller-2.0/menu
Inside that menu folder, there's a .SPEC file. So, I run the following in terminal
python pyinstaller.py /Users/.../Desktop/BuildFolder/menu/menu.spec
After this runs, I found a .PKG file in that folder but it's not labeled anything like menu.py . I can't figure out what to do next, and I'm not sure if I'm supposed to run other files.
I am not sure ( haven't tried this yet ), but maybe you have to run Build.py while working with .SPEC file?