pyinstaller .exe file doesn't work on another computer - python

I have used pyinstaller to compile the py file into exe, on my computer it is working well
but when i am trying to download it on another computer it's always giving me error,
FileNotFound: no such file or directory when i compiled the py file i added the python39.dll.
here is the command i used:
pyinstaller --noconfirm --onefile --console --add-binary "C:/Users/Usern/Desktop/dist/python39.dll;." "C:/Users/Usern/Desktop/dist/m.py"
I am trying to create a file with this command:
f1 = open("C:\\Users\\Usern\\AppData\\Local\\Mine\\x.exe", "wb").write(x_req)
again in my computer that .exe file works well as should be but in another computer it does not work.

The program is trying to pull in a file that isnt on the computer. I had the same problem when my program used an image, it had to be in the same directory.

Related

The .exe file I converted from Pyinstaller can't be run

I have made a python file and it is a pygame. I want to convert it into a .exe file.
So, I used PyInstaller
I did pyinstaller --one file -w main.py
and it made a .exe file.
However, when I double-click it, it popped up a
Not Running warning
Why does it occur and what should I do to prevent it?

run python program via clickable desktop icon

I've made a python program using Tkinter(GUI) and I would like to enter it by creating a dedicated icon on my desktop. (I want to send the file to my friend, without him having to install python or any interpreter)
the file is a some-what game that I want to share with friends and family, which are not familiar with coding.
You can simply use Pyinstaller to create a standalone .exe.
Run this from the Windows cmd to create a standalone executable file: pyinstaller.exe --onefile --noconsole --icon=your_image_here.ico app.py
you can install Pyinstaller by using pip
pip install pyinstaller
go to the directory where your file is saved and type:
pyinstaller.exe --onefile --windowed path/to/your/file.py
--onefile (compresses your files into one .exe file)
--windowed (removes the console when you run your file)
path/to/your/file.py (or simply file.py when you want to convert the file in the same directory)
if you have any error using it, remove the --windowed flag and run file.exe on command line to see the error

Pick up directory with pyinstaller

I have made a small programm with Python 3 and Qt-Designer using Pyqt5.
the programm should open a pdf file which is located on a directory on my pc and another exe file, which is also on my pc.
I'm using in the code:
os.startfile("D:\Python_files\MA\Programm\K_file\dist\K_D\K_D.exe")
os.startfile("D:\Python_files\MA\Programm\Help.pdf")
then I used pyinstaller to make it standalone app. The problem is that pyinstaller does not pick up those two file (pdf and exe). So when somebodyelse download the app on thier pc, it wont work because the pdf and the exe are missing.
How to fix this?
I'm using this command in pyinstaller
pyinstaller --onefile --icon="if_icon_64682.ico" --clean ProgV_1_6_Final.py

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.

Pyinstaller tells me he created the .exe file but I can't find it

Well basically i did this:
pyinstaller --onefile --name=OrdnerErstellen --windowed "filepath"
And it worked out but then I copied the Path where my .exe file should be and my PC couldn't find the file. Does somebody know why?
It also didn't even create the dist folder where all these files are supposed to go...
Im really new to programming and I just wanted to try it out :)
EDIT: PyInstaller did make a compiled .pyc file for the one I wanted, but didn't create the .exe
Simple navigate to the folder where you kept your_script.py file , From there run on console pyinstaller --onefile your_script.py

Categories

Resources