A .py to .exe converter using a simple graphical interface and PyInstaller in Python.
阅读中文版的README ,点击 这里
Suomenkieliset käyttöohjeet löydät täältä
Türkçe Talimatları burada bulabilirsiniz.
دستور العمل های فارسی
한국어로 된 설명은 여기를 참고하세요.
Demo
Getting Started
Prerequisites
- Python : 3.6-3.11
To have the interface displayed in the images, you will need chrome. If chrome is not installed or —no-chrome is supplied, the default browser will be used.
As of PyInstaller 4.0, Python 2.7 is no longer supported. Read «Python 2.7 Support» below for steps on how to use this tool with Python 2.7.
Installation and Usage
Installing Via PyPI
You can install this project using PyPI:
$ pip install auto-py-to-exe
Then to run it, execute the following in the terminal:
$ auto-py-to-exe
If you have more than one version of Python installed, you can use
python -m auto_py_to_exe
instead ofauto-py-to-exe
.
Installing Via GitHub
$ git clone https://github.com/brentvollebregt/auto-py-to-exe.git
$ cd auto-py-to-exe
$ python setup.py install
Then to run it, execute the following in the terminal:
$ auto-py-to-exe
Running Locally Via Github (no install)
You can run this project locally by following these steps:
- Clone/download the repo
- Open cmd/terminal and cd into the project
- Execute
python -m pip install -r requirements.txt
Now to run the application, execute python -m auto_py_to_exe
. A Chrome window in app mode will open with the project running inside.
Make sure you are in the directory below auto_py_to_exe (you will be after step 3) when calling
python -m auto_py_to_exe
or you will need to reference the folder auto_py_to_exe absolutely/relatively to where you currently are.
Using the Application
- Select your script location (paste in or use a file explorer)
- Outline will become blue when file exists
- Select other options and add things like an icon or other files
- Click the big blue button at the bottom to convert
- Find your converted files in /output when completed
Easy.
Arguments
Usage: auto-py-to-exe [-nc] [-c [CONFIG]] [-o [PATH]] [filename]
Argument | Type | Description |
---|---|---|
filename | positional/optional | Pre-fill the «Script Location» field in the UI. |
-nc, —no-chrome | optional | Open the UI using the default browser (which may be Chrome). Will not try to find Chrome. |
-nu, —no-ui | optional | Don’t try to open the UI in a browser and simply print out the address that the application can be accessed at. |
-c [CONFIG], —config [CONFIG] | optional | Provide a configuration file (json) to pre-fill the UI. These can be generated in the settings tab. |
-o [PATH], —output-dir [PATH] | optional | Set the default output directory. This can still be changed in the ui. |
-bdo [FOLDER_PATH], —build-directory-override [FOLDER_PATH] | optional | Override the default build directory. Useful if you need to whitelist a folder to stop your antivirus from removing files. |
-lang [LANGUAGE_CODE], —language [LANGUAGE_CODE] | optional | Hint the UI what language it should default to when opening. Language codes can be found in the table under «Translations» below. |
If you are running this package locally, you will need to call
python -m auto_py_to_exe
instead ofauto-py-to-exe
JSON Configuration
Instead of inserting the same data into the UI over and over again, you can export the current state by going to the «Configuration» section within the settings tab and exporting the config to a JSON file. This can then be imported into the UI again to re-populate all fields.
This JSON config export action does not save the output directory automatically as moving hosts could mean different directory structures. If you want to have the output directory in the JSON config, add the directory under nonPyinstallerOptions.outputDirectory
in the JSON file (will need to create a new key).
Video
If you need something visual to help you get started, I made a video for the original release of this project; some things may be different but the same concepts still apply.
Issues Using the Tool
If you’re having issues with the packaged executable or using this tool in general, I recommend you read my blog post on common issues when using auto-py-to-exe. This post covers things you should know about packaging Python scripts and fixes for things that commonly go wrong.
If you believe you’ve found an issue with this tool, please create an issue (click «Get started») and fill out the template provided by the «Bug report» option. If your issue is only associated with your application, please do not create an issue in this repository — instead, comment on the help post, video or create a new discussion.
When filling out the template, be sure to clearly explain what’s happening, give reproduction steps and a minimal reproducible example and explain what you believe should have happened. Without these, it’s going to take longer to identify the issue.
Translations
Language | Translator | Translated |
---|---|---|
Arabic (العربية) | Tayeb-Ali | UI |
Brazilian Portuguese (Português Brasileiro) | marleyas, reneoliveirajr | UI |
Chinese Simplified (简体中文) | jiangzhe11 | UI and README |
Chinese Traditional (繁體中文) | startgo | UI |
Czech | Matto58 | UI |
English | — | UI and README |
Finnish (Suomen kieli) | ZapX5 | UI and README |
French (Français) | flaviedesp | UI |
German (Deutsch) | hebens, ackhh | UI |
Greek (Ελληνικά) | sofronas | UI |
Indonesian (Bahasa Indonesia) | MarvinZhong | UI |
Italian (Italiano) | itsEmax64 | UI |
Japanese (日本語) | NattyanTV | UI |
Korean (한국어) | jhk1090 | UI and README |
Persian (فارسی) | DrunkLeen, Ar.dst | UI and README |
Russian (Русский) | Oleg | UI |
Spanish (Español) | enriiquee | UI |
Spanish Latam (Español Latam) | Matyrela | UI |
Serbian | rina | UI |
Thai (ภาษาไทย) | teerut26 | UI (partial) |
Turkish (Türkçe) | mcagriaksoy | UI and README |
Ukrainian (Українська) | AndrejGorodnij | UI |
Vietnamese (Tiếng Việt) | 7777Hecker | UI |
Want to add a translation for another language? Update i18n.js and submit a PR or attach it in an issue.
Python 2.7 Support
As of PyInstaller v4.0 released on Aug 9 2020, Python 2.7 is no longer supported; although you can still use this tool with Python 2.7 by installing an older version of PyInstaller. PyInstaller v3.6 was the last version that supported Python 2.7; to install this, first uninstall any existing versions of PyInstaller and then execute python -m pip install pyinstaller==3.6
.
Testing
Tests are located in tests/
and are run using pytest:
$ pip install pytest
$ pip install -e .
$ pytest
Screenshots
Auto PY to EXE
A .py to .exe converter using a simple graphical interface and PyInstaller in Python.
阅读中文版的README ,点击 这里
Suomenkieliset käyttöohjeet löydät täältä
Türkçe Talimatları burada bulabilirsiniz.
دستور العمل های فارسی
한국어로 된 설명은 여기를 참고하세요.
Demo
Getting Started
Prerequisites
- Python : 3.6-3.11
To have the interface displayed in the images, you will need chrome. If chrome is not installed or —no-chrome is supplied, the default browser will be used.
As of PyInstaller 4.0, Python 2.7 is no longer supported. Read «Python 2.7 Support» below for steps on how to use this tool with Python 2.7.
Installation and Usage
Installing Via PyPI
You can install this project using PyPI:
$ pip install auto-py-to-exe
Then to run it, execute the following in the terminal:
If you have more than one version of Python installed, you can use
python -m auto_py_to_exe
instead ofauto-py-to-exe
.
Installing Via GitHub
$ git clone https://github.com/brentvollebregt/auto-py-to-exe.git
$ cd auto-py-to-exe
$ python setup.py install
Then to run it, execute the following in the terminal:
Running Locally Via Github (no install)
You can run this project locally by following these steps:
- Clone/download the repo
- Open cmd/terminal and cd into the project
- Execute
python -m pip install -r requirements.txt
Now to run the application, execute python -m auto_py_to_exe
. A Chrome window in app mode will open with the project running inside.
Make sure you are in the directory below auto_py_to_exe (you will be after step 3) when calling
python -m auto_py_to_exe
or you will need to reference the folder auto_py_to_exe absolutely/relatively to where you currently are.
Using the Application
- Select your script location (paste in or use a file explorer)
- Outline will become blue when file exists
- Select other options and add things like an icon or other files
- Click the big blue button at the bottom to convert
- Find your converted files in /output when completed
Easy.
Arguments
Usage: auto-py-to-exe [-nc] [-c [CONFIG]] [-o [PATH]] [filename]
Argument | Type | Description |
---|---|---|
filename | positional/optional | Pre-fill the «Script Location» field in the UI. |
-nc, —no-chrome | optional | Open the UI using the default browser (which may be Chrome). Will not try to find Chrome. |
-nu, —no-ui | optional | Don’t try to open the UI in a browser and simply print out the address that the application can be accessed at. |
-c [CONFIG], —config [CONFIG] | optional | Provide a configuration file (json) to pre-fill the UI. These can be generated in the settings tab. |
-o [PATH], —output-dir [PATH] | optional | Set the default output directory. This can still be changed in the ui. |
-bdo [FOLDER_PATH], —build-directory-override [FOLDER_PATH] | optional | Override the default build directory. Useful if you need to whitelist a folder to stop your antivirus from removing files. |
-lang [LANGUAGE_CODE], —language [LANGUAGE_CODE] | optional | Hint the UI what language it should default to when opening. Language codes can be found in the table under «Translations» below. |
If you are running this package locally, you will need to call
python -m auto_py_to_exe
instead ofauto-py-to-exe
JSON Configuration
Instead of inserting the same data into the UI over and over again, you can export the current state by going to the «Configuration» section within the settings tab and exporting the config to a JSON file. This can then be imported into the UI again to re-populate all fields.
This JSON config export action does not save the output directory automatically as moving hosts could mean different directory structures. If you want to have the output directory in the JSON config, add the directory under nonPyinstallerOptions.outputDirectory
in the JSON file (will need to create a new key).
Video
If you need something visual to help you get started, I made a video for the original release of this project; some things may be different but the same concepts still apply.
Issues Using the Tool
If you’re having issues with the packaged executable or using this tool in general, I recommend you read my blog post on common issues when using auto-py-to-exe. This post covers things you should know about packaging Python scripts and fixes for things that commonly go wrong.
If you believe you’ve found an issue with this tool, please create an issue (click «Get started») and fill out the template provided by the «Bug report» option. If your issue is only associated with your application, please do not create an issue in this repository — instead, comment on the help post, video or create a new discussion.
When filling out the template, be sure to clearly explain what’s happening, give reproduction steps and a minimal reproducible example and explain what you believe should have happened. Without these, it’s going to take longer to identify the issue.
Translations
Language | Translator | Translated |
---|---|---|
Arabic (العربية) | Tayeb-Ali | UI |
Brazilian Portuguese (Português Brasileiro) | marleyas, reneoliveirajr | UI |
Chinese Simplified (简体中文) | jiangzhe11 | UI and README |
Chinese Traditional (繁體中文) | startgo | UI |
Czech | Matto58 | UI |
English | — | UI and README |
Finnish (Suomen kieli) | ZapX5 | UI and README |
French (Français) | flaviedesp | UI |
German (Deutsch) | hebens, ackhh | UI |
Greek (Ελληνικά) | sofronas | UI |
Indonesian (Bahasa Indonesia) | MarvinZhong | UI |
Italian (Italiano) | itsEmax64 | UI |
Japanese (日本語) | NattyanTV | UI |
Korean (한국어) | jhk1090 | UI and README |
Persian (فارسی) | DrunkLeen, Ar.dst | UI and README |
Russian (Русский) | Oleg | UI |
Spanish (Español) | enriiquee | UI |
Spanish Latam (Español Latam) | Matyrela | UI |
Serbian | rina | UI |
Thai (ภาษาไทย) | teerut26 | UI (partial) |
Turkish (Türkçe) | mcagriaksoy | UI and README |
Ukrainian (Українська) | AndrejGorodnij | UI |
Vietnamese (Tiếng Việt) | 7777Hecker | UI |
Want to add a translation for another language? Update i18n.js and submit a PR or attach it in an issue.
Python 2.7 Support
As of PyInstaller v4.0 released on Aug 9 2020, Python 2.7 is no longer supported; although you can still use this tool with Python 2.7 by installing an older version of PyInstaller. PyInstaller v3.6 was the last version that supported Python 2.7; to install this, first uninstall any existing versions of PyInstaller and then execute python -m pip install pyinstaller==3.6
.
Testing
Tests are located in tests/
and are run using pytest:
$ pip install pytest
$ pip install -e .
$ pytest
Screenshots
Проверено на Python 3 — работает
Установка:
>c:\users\user\AppData\Local\Programs\Python\Python36\python.exe -m pip install auto-py-to-exe
Collecting auto-py-to-exe
Downloading auto_py_to_exe-2.7.4-py2.py3-none-any.whl (74 kB)
|████████████████████████████████| 74 kB 84 kB/s
....
Successfully installed Eel-0.11.0 altgraph-0.17 auto-py-to-exe-2.7.4 bottle-0.12
.18 bottle-websocket-0.2.9 cffi-1.14.0 future-0.18.2 gevent-20.6.0 gevent-websoc
ket-0.10.1 greenlet-0.4.16 pefile-2019.4.18 pycparser-2.20 pyinstaller-3.6 pywin
32-ctypes-0.2.0 whichcraft-0.6.1 zope.event-4.4 zope.interface-5.1.0
После успешной установки в папке Python36\Scripts\ появится auto-py-to-exe.exe, запускаем его
Выбираем скрипт, выставляем нужные настройки и жмём снизу «CONVERT .PY TO .EXE«. Появляется папка output с откомпилированным скриптом program.exe
This project allows you to convert python scripts to executables with a simple interface. The interface uses chromes app mode and lists all possible flags for pyinstaller. The whole idea seems automatic as it cleans up after itself.
What is this?
This application displays a simple interface that allows you to convert py to exe easily. By just selecting the file, if you want it to convert to onefile and if you want a console, you will only need to press convert and wait for the script to do the rest.
The script is built using Eel and uses PyInstaller to convert the script
Demo
Getting Started
Prerequisites
- Python : 3.6-3.10
To have the interface displayed in the images, you will need chrome. If chrome is not installed or —no-chrome is supplied, the default browser will be used.
Installation and Usage
Installing Via PyPI
You can install this project using PyPI:
$ pip install auto-py-to-exe
Then to run it, execute the following in the terminal:
Installing Via GitHub
$ git clone https://github.com/brentvollebregt/auto-py-to-exe.git
$ cd auto-py-to-exe
$ python setup.py install
Then to run it, execute the following in the terminal:
Running Locally Via Github (no install)
You can run this project locally by following these steps:
1. Clone/download the repo
2. Open cmd/terminal and cd into the project
3. Execute python -m pip install -r requirements.txt
Now to run the application, execute python -m auto_py_to_exe
. A Chrome window in app mode will open with the project running inside.
Make sure you are in the directory below auto_py_to_exe (you will be after step 3) when calling
python -m auto_py_to_exe
or you will need to reference the folder auto_py_to_exe absolutely/relatively to where you currently are.
Using the Application
- Select your script location (paste in or use a file explorer)
- Outline will become blue when file exists
- Select other options and add things like an icon or other files
- Click the big blue button at the bottom to convert
- Find your converted files in /output when completed
Easy.
Arguments
Usage: auto-py-to-exe [-nc] [-c [CONFIG]] [filename]
Argument | Type | Description |
---|---|---|
filename | positional | Pre-fill the «Script Location» field in the UI. |
-nc, —no-chrome | optional | Open the UI using the default browser (which may be Chrome). Will not try to find Chrome |
-c [CONFIG], —config [CONFIG] | optional | Provide a configuration file (json) to pre-fill the UI. These can be generated in the settings tab. |
-o [PATH], —output-dir [PATH] | optional | Set the default output directory. This can still be changed in the ui. |
If you are running this package locally, you will need to call
python -m auto_py_to_exe
instead ofauto-py-to-exe
JSON Configuration
Instead of inserting the same data into the UI over and over again, you can export the current state by going to the «Configuration» section within the settings tab and exporting the config to a JSON file. This can then be imported into the UI again to re-populate all fields.
This JSON config export action does not save the output directory automatically as moving hosts could mean different directory structures. If you want to have the output directory in the JSON config, add the directory under nonPyinstallerOptions.outputDirectory
in the JSON file (will need to create a new key).
Video
If you need something visual to help you get started, I made a video for the original release of this project; some things may be different but the same concepts still apply.
If you’re having issues with the packaged executable or using this tool in general, I recommend you read my blog post on common issues when using auto-py-to-exe. This post covers things you should know about packaging Python scripts and fixes for things that commonly go wrong.
Screenshots
Response
I really wanted to get this project out there so I released a YouTube video demonstrating how to set up and use the interface (video above). A day later I made a post in the /r/Python subreddit titled «Auto Py to Exe is Complete».
To my surprise, the next morning (about 7 hours) I had more than 300 upvotes which to me was a big thing. I had many replies which I took time to read and reply to. About 44 hours later the post finally lost its top place on the subreddit and the post is sitting at 454 points with 12.1k views and 75 comments.
I can’t believe how big this got and it means a lot to me when I saw people thanking me for the project. When a couple of issues came to the Github repo I realised people do care about this and I was quick to fix these.
Once again, thank you for the support; I loved making this project.
Auto-py-to-exe is a Python script that converts your Python script into a standalone executable, which can run on Windows without requiring a Python interpreter. This allows you to distribute your Python script to users who may not have Python installed on their computer.
Before we begin, you will need to have Python and pip (Python package manager) installed on your computer.
To install auto-py-to-exe, you can use pip by running the following command:
pip install auto-py-to-exe
Once auto-py-to-exe is installed, you can convert your Python script to an executable by running the following command in the command prompt:
This will open a graphical user interface (GUI) where you can select the script you want to convert, configure the options and then build the executable.
For example, if you have a script called «myscript.py» that you want to convert to an executable, you would navigate to the folder where the script is located and run the command:
auto-py-to-exe myscript.py
You can also pass various options to the command line like specifying the icon of the executable, the output directory and whether you want the executable to be one file or one directory.
For example, if you want to specify the icon for the executable as «icon.ico» and output the executable to a folder called «dist», you would run the command:
auto-py-to-exe myscript.py --icon=icon.ico --output dist --onefile
You can find more options and examples on the Github page of auto-py-to-exe : https://github.com/brentvollebregt/auto-py-to-exe
Once the script is converted, you can distribute the executable file to users who can run it on their Windows machine without needing to install Python.
In conclusion, auto-py-to-exe is a useful tool for converting your Python script into a standalone executable, which can be easily distributed to users on Windows. It is easy to use and provides a variety of options for customizing the output.
In addition to auto-py-to-exe, there are other tools available for converting Python scripts to executables on Windows. One popular alternative is cx_Freeze, which is a set of scripts for freezing Python scripts into executables. It can be installed using pip with the command:
Once cx_Freeze is installed, you can create an executable by creating a setup.py script. This script will specify the script to be frozen, as well as any additional modules or files that the script requires.
For example, a basic setup.py script for freezing a script called «myscript.py» would look like this:
from cx_Freeze import setup, Executable setup(name = "myscript" , version = "0.1" , description = "" , executables = [Executable("myscript.py")])
You can then run the command python setup.py build
to create the executable in a subdirectory called «build» within your script’s directory.
Another alternative tool for converting Python scripts to executables on Windows is Pyinstaller, which can be installed via pip as well with the command:
Once Pyinstaller is installed, you can create an executable by running the command pyinstaller yourscript.py
. This will create a standalone executable in a subdirectory called «dist» within your script’s directory.
Pyinstaller also offers advanced options like the ability to bundle data files, specifying icon, and password protection of the executable.
It’s worth noting that these tools are not limited to Windows, they are also compatible with other operating systems such as MacOS and Linux.
In conclusion, auto-py-to-exe, cx_Freeze, and Pyinstaller are all popular tools that can be used to convert Python scripts to executables on Windows. Each tool has its own unique features and capabilities, and the best one to use will depend on your specific needs and requirements.
Popular questions
-
What is auto-py-to-exe and what is it used for?
Auto-py-to-exe is a Python script that converts your Python script into a standalone executable, which can run on Windows without requiring a Python interpreter. This allows you to distribute your Python script to users who may not have Python installed on their computer. -
How can I install auto-py-to-exe on my computer?
To install auto-py-to-exe, you can use pip by running the following command:
pip install auto-py-to-exe
- How do I convert a Python script to an executable using auto-py-to-exe?
Once auto-py-to-exe is installed, you can convert your Python script to an executable by running the following command in the command prompt:
This will open a graphical user interface (GUI) where you can select the script you want to convert, configure the options and then build the executable.
-
Are there any other options available to convert python script to executable on windows?
Yes, there are other tools available for converting Python scripts to executables on Windows. cx_Freeze and Pyinstaller are popular alternatives to auto-py-to-exe. -
What are the advantages of using auto-py-to-exe to create executables?
auto-py-to-exe is easy to use and provides a variety of options for customizing the output. It has a graphical user interface (GUI) which makes it easy to configure and build the executable. Additionally, it is compatible with other operating systems such as MacOS and Linux.
Tag
Conversion