Auto py to exe linux

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Converts .py to .exe using a simple graphical interface

License

brentvollebregt/auto-py-to-exe

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A .py to .exe converter using a simple graphical interface and PyInstaller in Python.

Empty interface

Suomenkieliset käyttöohjeet löydät täältä

Türkçe Talimatları burada bulabilirsiniz.

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.

You can install this project using PyPI:

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 of auto-py-to-exe .

$ 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.

  1. Select your script location (paste in or use a file explorer)
    • Outline will become blue when file exists
  2. Select other options and add things like an icon or other files
  3. Click the big blue button at the bottom to convert
  4. Find your converted files in /output when completed
Читайте также:  Get link path linux

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 of auto-py-to-exe

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).

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.

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.

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
Persian (قارسی) DrunkLeen UI
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.

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 .

Читайте также:  Astra linux generic recovery mode

Tests are located in tests/ and are run using pytest:

$ pip install pytest $ pip install -e . $ pytest 

Источник

How to Convert .Py Files to .Exe (Windows, macOS, Linux)

How to Convert PNG to TIFF in Python?

A .py file extension is used when the file of a program or script is written in Python . So, these files ending with the .py extension can be written and modified with almost any text editor. However, if you want to run the file, you would need a Python interpreter .

On the other hand, a .exe file extension is used by Windows executable program files. EXE stands for “executable” and it’s very commonly used by programs on Windows which is why it may sound familiar to you. This is because EXE files contain code that can be easily understood and directly executed by a computer.

That being said, there are many reasons why someone may want to convert a .py file to .exe. Maybe you just created an app using Python and want your friend to test it. Besides that, maybe you need someone to run a script you just wrote to automate a task for them. So, double-clicking on an executable file is much easier than for example, downloading and installing Python and running the file from the command line.

Fortunately for us, there are tools that we can use to do this in a few simple steps.

In this guide, we’ll go over how to convert a .py file to .exe on Windows , Linux , and macOS .

Table of Contents

Using pyinstaller to convert .py file to .exe (Windows, Linux, and macOS)

PyInstaller is a Python package that compiles a Python application and its dependencies into one package. So, this packaged app can then be executed by the user without the need to install the Python interpreter or any other modules.

Before we begin the conversion of a file from .py to .exe, we will need to install a package called PyInstaller . In order to install a package using the native command line, simply enter:

For this example, I will be using a simple program called test.py that prints out a string. Once PyInstaller has been installed, proceed to:

open terminal on macOS or Linux

Using pyinstaller to convert .py files or scripts to .exe files

Once you see this at the end of the command line, you’re good to go!

Using pyinstaller to convert .py files or scripts to .exe files

  1. Next, navigate to your project’s folder. There will be a few new files and folders created in your project’s folder, one of them being called dist . Open the dist folder and there will be another folder called test .

Using pyinstaller to convert .py files or scripts to .exe files

Inside this test folder, there will be an exe file named after your original python file. In this case, it is named test.exe.

Читайте также:  Vmware toolbox cmd linux

Opening py files that have been converted to .exe file

When double-clicked, a Command Prompt window will open and the code will be executed.

Opening py files that have been converted to .exe file

This same method can be used to convert files from .py to .exe on Linux and macOS as well.

Using cx_freeze to convert .py file to .exe

Another way to convert .py files to .exe is by using cx_freeze . Cx_freeze is used to create executable files from python scripts and it is cross-platform.

Before starting, let’s say we want to convert a program called test.py . To use cx_freeze, we have to:

  1. First, create a file called setup.py in the same folder where test.py is located.
  2. Then, edit the setup.py file to contain the following:
from cx_Freeze import setup, Executable setup(name = "test", version = 1, executables = [Executable("test.py")])
  1. After that, open the Command Prompt and navigate to the folder where setup.pyand test.py are located.

run Command Prompt as an administrator on Windows

Once completed, the test.exe file will be found in a folder that is located inside the same folder as setup.py. For example, my setup.py is inside a folder called test. Hence, my test.exe can be found in test\build\exe.win-amd64-3.8 .

Opening py files that have been converted to .exe file

Using Auto PY to EXE application to convert one or more .py files to .exe (Windows)

Auto PY to EXE is a GUI application that makes it extremely easy and straightforward to convert files. In order to use Auto PY to EXE, we have to first install it through the command line:

run Command Prompt as an administrator on Windows

Then, a GUI should appear on your screen.

Using Auto PY to EXE application to convert one or more .py files to .exe

The next step is to browse and select the .py file that you wish to convert to .exe.

Using Auto PY to EXE application to convert one or more .py files to .exe

Once the file has been selected, you need to choose either the One Directory or One File option. One Directory essentially means that all the files and dependencies related to the project file will be placed in a single directory. One File means that the application will create a single .exe file consisting of all project dependencies excluding media files.

For this example, I will be proceeding with the following configuration:

Using Auto PY to EXE application to convert one or more .py files to .exe

Once the conversion has been completed, you will see a similar message in the output box:

Using Auto PY to EXE application to convert one or more .py files to .exe

So, proceed to the folder mentioned to find the converted .exe file:

Opening py files that have been converted to .exe file

You can read more about using Auto PY to EXE here .

Conclusion

Learning how to convert a python file to an executable file is a very useful skill for any python developer or programmer.

There are many reasons why someone would have to convert a python file to an executable file. This seemingly simple but yet important task can help in many ways ranging from increasing the user-friendliness of a program to enabling a non-computer savvy person to be able to use and understand a script they made to help them automate a certain task.

In this article, we looked at the many different ways for a developer to convert .py files to .exe. These include using PyInstaller , cx_Freeze , and a GUI application called Auto PY to EXE .

With that being said, we hope you’ve found this guide helpful when it comes to making your python files executable in your development space.

Feel free to share this post with your fellow coders to guide them through converting their .py files to .exe!

Источник

Оцените статью
Adblock
detector