Create exe files from .py - python

I have a program with python and it has 3 modules .py.
what should i do to create exe format of this program?
i try this with pyinstaller but thats create exe for my main .py and other .py
modules not contains in it!

Install pyinstaller:
Go to command prompt and type pip install pyinstaller.
Create .exe:
If you want to create a .exe from a .py you need to open your command prompt under the correct directory of the file and type:
pyinstaller —-onefile filename // e.g hello.py as the filename
If it has any basic graphics, type the following in command prompt
pyinstaller —-onefile -w then your file name
This should all work.
If it does not I recommend that you watch this video.

Related

pyinstaller python file + exe in only one exe

py file in which I am executing a .exe file created in C++ (is inside a "data" folder)
Python Code:
os.system("data\\time.exe")
When I use the pyinstaller with the --onefile attribute I can't find a way for my program to compile the .py file + the "data" with another .exe inside.
Does anyone know how to convert my entire program into a single .exe? in which I can run my python program and also my .exe from C++ inside?
(I have tried to test with the .spec and with the --add-data attribute but I can't find a way that is compatible with what I want to do)
I look forward to your response,
Thanks you very much <3
There is a program called auto-py-to-exe which creates an exe out of your program without requiring you to create a setup file. The interface is great and allows you to easily create and exe without creating a setup.py. This also allows you to package your app as a single exe, without any other files. Below is a screenshot:
You can install the program by typing into the command line:
python -m pip install auto-py-to-exe
You can run it by typing in:
auto-py-to-exe
To see more about auto-py-to-exe, please visit the PyPI page at https://pypi.org/project/auto-py-to-exe/.

.exe built with pyinstaller is only opened while running from cmd

I created a pyinstaller .exe that is built correctly without any mistakes with pyinstaller. When I run it from the cmd, it runs perfectly, but when I double click the .exe file, it does not work. I read that has to do something with PyQt5, but I didn't make it work. This is the creation statement:
pyinstaller --paths
C:\Users\430350\AppData\Local\Programs\Python\Python36\Lib\site-
packages\PyQt5\Qt\bin "path" --hidden-import numpy.core._dtype_ctypes --hidden-
import fix_qt_import_error --icon=icon.ico --noconfirm
Thanks in advance!
Don’t know if it’s the same in Windows. But using pyinstaller in Linux with the -F option (pyinstaller -F file.py) with a PyQt5 project I have to add to the binary file folder .qss and .ui files manually my resource.py file and enclosed png. are not read too. Also did you check the versione you are using ? Python 2 vs 2, 3 vs 3 etc ... v

Is there a way to convert a group of python files to exe?

I have a bunch of .py files and I want them to be converted to exe.
I know how to do that with a single .py script, but don't know how to convert multiple python files into a single application.
Also can we convert python scripts with js files also to .exe??
Actually I have 4 .py scripts with one .js script. They are all connected with each other to run. Is there a way out to convert them to .exe?
Any help would be appreciated...
Install py installer.
pip install PyInstaller
Execute the following command into your project directory.
pyinstaller --onefile --add-data '<your .js file name here>.js:.' <your main python file name here>.py
the above command will generate dist directory in that you will get your exe

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

Converting Python program with command line argument into executable using PyInstaller

I would like to convert a python code with command line argument into windows executable using pyInstaller. I run my python program as follows
python myPython 1
Firstly i wonder that you don't get articles related to to this in your Google search.
First Install pyinstaller by running this command
pip install pyinstaller
For Additional Help
https://pyinstaller.readthedocs.io/en/stable/installation.html
Open command prompt, Now navigate to the directory in which your python file (using the cd command ) is located then enter the code
pyinstaller --onefile .py
This will create a standalone executable file (That i expect you are asking). Below is the link to a stackoverflow question you missed to read. Edit : in the same directory a folder name dist will get created which have your single executable.
How can I convert a .py to .exe for Python?

Categories

Resources