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.
Related
This question already has answers here:
Create a single executable from a Python project [closed]
(3 answers)
Closed 1 year ago.
I want to execute three python script that I have developed. I found one doubt, how could I do it using a python script?
I want to convert it into a .exe, because our solution is thought to be executed in machines without python installed so having an unique script would be helpful.
Edit: I don't know the cause of the closure, I know how to use pyinstaller, my question was how can I execute 3 python using a python script or if it is possible.
Any suggestion? Thanks!
To package script and all dependencies you can use Pyinstaller, see here.
To execute multiple script (or exe) you can write a bat file that start the 3 exe or use them as services, based on your needs.
Use pyinstaller it can convert python to executables. You can get it up and running simply by doing
pip install pyinstaller
pyinstaller myfile.py
This question already has answers here:
How can I convert a .py to .exe for Python?
(8 answers)
Closed 2 years ago.
Iam developing a python program which included pyqt5 and also mysql.connector for using mysql as back end.
I have almost completed the program and it contains about 20 .py files for different qt window.
How to convert this to .exe format?
Have you considered using Pyinstaller?
It's as simple as installing it:
pip install pyinstaller
and then running it against the name of your main python file. E.g., if it's called main.py:
pyinstaller --onefile main.py
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
This question already has answers here:
Create a single executable from a Python project [closed]
(3 answers)
Closed 8 years ago.
Writing some project on Python via PyCharm.
I want to get an exe file from it.
I've tried to "Save as->XXX.exe" - but ,when i'm trying to execute it there is an error "file is not supported with such kind of OS"
p.s.
i've got win7 x64,it doesn't work on x32 too.
You cannot directly save a Python file as an exe and expect it to work -- the computer cannot automatically understand whatever code you happened to type in a text file. Instead, you need to use another program to transform your Python code into an exe.
I recommend using a program like Pyinstaller. It essentially takes the Python interpreter and bundles it with your script to turn it into a standalone exe that can be run on arbitrary computers that don't have Python installed (typically Windows computers, since Linux tends to come pre-installed with Python).
To install it, you can either download it from the linked website or use the command:
pip install pyinstaller
...from the command line. Then, for the most part, you simply navigate to the folder containing your source code via the command line and run:
pyinstaller myscript.py
You can find more information about how to use Pyinstaller and customize the build process via the documentation.
You don't necessarily have to use Pyinstaller, though. Here's a comparison of different programs that can be used to turn your Python code into an executable.
This question already has answers here:
Create a single executable from a Python project [closed]
(3 answers)
Closed 9 years ago.
Is there any way or tool to automatically change python output script format (.py) to exe ? I want to run my app on every Windows computers including that haven't got installed python.
I had to do this a while ago and I had the most success with py2exe: http://www.py2exe.org/
You create a setup.py file which gives a list of what Python code you want to include in your executable, and it packages that up along with a subset of the Python interpreter into a single exe. Works specifically on Windows. (Linux and Mac generally already have Python installed so it's much less of an issue there.)