Create executable without console from a .pyw file [duplicate] - python

This question already has answers here:
How to convert a pyw file to exe?
(2 answers)
Closed 1 year ago.
I made a application that has to can run in background, so I made a script.pyw but I don't know how to make a executable that can do it .
can you please help me ?

You can use pyinstaller to do so. First, install pyinstaller:
$ pip install pyinstaller
Then, run pyinstaller, passing the file to convert
$ pyinstaller script.pyw --onefile --windowed

Related

How do you set up a python project to be able to send to others without them having to manually copy and paste the code into an editor [duplicate]

This question already has answers here:
Create a directly-executable cross-platform GUI app using Python
(13 answers)
Closed 2 years ago.
I made a cool little project for my friend, basically a timer using tkinter, but I am confused on how to let them access this project without having vscode or pycharm. Is it possible for them to just see the Tkinter window or something like that? Is there an application for this? Sorry if this is a stupid question.
You can just built an .exe (Application) of your project. Then just share the application file and anyone can use the application through .exe. You can use pyinstaller to convert your python code to exe.
pip install pyinstaller
then cd to the project folder then run the following command
pyinstaller --onefile YourFileName.py
if you want to make exe without console showing up then use this command
pyinstaller --onefile YourFileName.py --noconsole

How to create an rpm from a python exe? [duplicate]

This question already has an answer here:
Python 3.5 create .rpm with pyinstaller generated executable
(1 answer)
Closed 2 years ago.
I have a set of python exe that is created using pyinstaller. I want to package these exe in .rpm . How do I do this ? The reason I need to do this is to enable me to install the rpm on a red hat linux server
PS : I don't have an option to switch from RPMs
I found the answer fortunately after hours of trying , you can wrap all the exe in a tar in %install stage of rpm spec and pass the name of the tar file in %file . If you have a single exe , you do not need to create a tar

How to convert python file to installer [duplicate]

This question already has answers here:
Create a single executable from a Python project [closed]
(3 answers)
Closed 1 year ago.
Hi everyone I want to convert my python file to installer(windows installer) not executable. I already make it executable through py2exe. How can I make an Installer of it. Is it possible.
Pyinstaller is a good option to convert python scripts to an windows executable.
You can install it in cmd.exe as any user and run pip install pyinstaller or pip install --pre pyinstaller.
you can then run it using pyinstaller. (sorry that i can't supply a automated script i wrote after a system restore. I'll write it again soon using pyqt5)
syntax
--onefile - puts the program and it's files into a exe.
--onedir - put your program into a directory (folder) (faster than --onefile as it does not need to extract files)
-c - create a console app.
-w - create an app without the console.
-i "[Path to .ico or exe with icon. e.g C:\Files\CODE\Icon.ico]" - set an icon for your app instead of the default snake-on-a-floppy-disk icon.
you can read the rest here.
You can then get inno setup and create an offline installer.
[sorry, could not be bothered to type it again]
i posted it on https://stackoverflow.com/posts/61597594

How to convert .py to .exe along with all its dependecies [duplicate]

This question already has answers here:
How can I make a Python script standalone executable to run without ANY dependency? [duplicate]
(19 answers)
Closed 2 years ago.
Suppose, I want to create a .exe file and i want all my features which are depended on certain packages or modules like tensorflow etc.So,how can i do this.
You can use something like pyinstaller, you can install it like this:
pip install pyinstaller
Once you install it, use this syntax to create to an exe:
pyinstaller yourprogram.py
This will create a .exe file from your program which will be in a dist folder and will include all dependencies along with it.
Additional documentation is avaialable here on how to include an icon etc.

Converting Python 3.6 script to .exe? [duplicate]

This question already has answers here:
How can I convert a .py to .exe for Python?
(8 answers)
Closed 5 years ago.
I would like to convert a .py file to an .exe. I am using Python 3.6. I already tried py2exe and PyInstaller but they don't seem to work properly with Python 3.6.
Here is the traceback from PyInstaller.
So, let's try Pyinstaller first.
$ pyinstaller script.py --onefile
This will generate a script.spec file
in the spec file you can remove the console, debug mode etc
$ pyinstaller script.py
EDIT: Py3.6 isn't supported
If this doesn't work then we can try cx_freeze,

Categories

Resources