Develop Windows apps with Python 3 + Tkinter (exe file)

Introduction

In the previous article (https://qiita.com/akagisho/items/7dfa6304b8233b85fa13), I used Tkinter to create a sample Windows application.

This time, you can use "PyInstaller" to convert a Python script into an exe file (executable file) and execute it even on Windows without a Python execution environment. To do so.

Preparation

pip installation

First, pip may not work well with PyDev of Pleiades, so reinsert pip.

Download get-pip.py from the following URL in official pip documentation and save it in a suitable folder.

Start a command prompt and run get-pip.py in PyDev's python.

C:\pleiades\python\3\python.exe (Downloaded folder)\get-pip.py

If a message like Successfully installed pip- ~ ~ is displayed, the installation is successful.

Installing PyInstaller

Next, install "PyInstaller" in the PyDev environment.

Start Eclipse and open [Window]-> [Settings] from the menu.

05.png

Open [PyDev]-> [Interpreter]-> [Python Interpreter] in the left menu. Select "Python3" and click the [Manage with pip] button.

40.png

Enter "ʻinstall pyinstaller`" in "Command to execute" and click the [Execute] button. When "FINISHED" is displayed, click the [Close] button.

41.png

Python script exe

Now that you have PyInstaller installed, use it to exe your Python script.

Start a command prompt and run pyinstaller.exe. At this time, specify the Python script you want to exe in the argument.

Execution example


cd C:\pleiades\workspace\testproj1

C:\pleiades\python\3\Scripts\pyinstaller.exe C:\pleiades\workspace\testproj1\test1.py --onefile --noconsole

If all goes well, an exe file will be created in the dist folder under the current directory of the command prompt (C: \ pleiades \ workspace \ testproj1 in the above example).

42.png

Double-click the generated exe file to execute it. The application starts after a while.

43.png

Recommended Posts

Develop Windows apps with Python 3 + Tkinter (exe file)
Develop Windows apps with Python 3 + Tkinter (Preparation)
[Python] Creating multiple windows with Tkinter
Efficiently develop Azure Python apps with CI/CD
Python starting with Windows 7
[Python] Create a Tkinter program distribution file with cx_Freeze
Programming with Python and Tkinter
Python with VS Code (Windows 10)
Run python with PyCharm (Windows)
Draw netCDF file with python
Run Label with tkinter [Python]
Time synchronization (Windows) with Python
Download csv file with python
Create an exe file that works in a Windows environment without Python with PyInstaller
[Python] Create a file & folder path specification screen with tkinter
[Python Kivy] How to create an exe file with pyinstaller
[Python] Show multiple windows in Tkinter
Extract the xz file with python
Face detection with YOLO Face (Windows10, Python3.6)
[Python] Write to csv file with Python
[Automation with python! ] Part 1: Setting file
Implemented file download with Python + Bottle
Output to csv file with Python
Monitor Python web apps with Prometheus
Create an Excel file with Python3
Build mlpy with python3.3 (64bit) (windows 64bit)
Use Windows 10 speech synthesis with Python
Python CGI file created on Windows
[Automation with python! ] Part 2: File operation
Getting started with Python 3.8 on Windows
[Python Windows] pip install with Python version
Japanese file enumeration with Python2 system on Windows (5C problem countermeasure)
Play video with sound with python !! (tkinter / imageio)
Creating a simple PowerPoint file with Python
Exclusive control with lock file in Python
Run servo with Python on ESP32 (Windows)
Read CSV file with python (Download & parse CSV file)
Automatic update method with python Pyinstaller exe
How to convert Python to an exe file
Check the existence of the file with python
Make GUI apps super easy with tkinter
Quickly create an excel file with Python #python
Building a Python 3.6 environment with Windows + PowerShell
Download the file by specifying the download destination with Python & Selemiun & Chrome (Windows version)
Let's read the RINEX file with Python ①
Creating an exe file with Python PyInstaller: PC freezes in parallel processing
Create Excel file with Python + similarity matrix
Record with Python → Save file (sounddevice + wave)
Run (legacy) Windows apps with Windows Application Driver
Let's develop an investment algorithm with Python 1
I made a configuration file with Python
[Automation] Read mail (msg file) with Python
Split mol2 file with python (-> 2016.04.17 Also supports sdf file)
Create a frame with transparent background with tkinter [Python]
How to read a CSV file with Python 2/3
Project cannot be created with Python3.5 (Windows) + django1.7.1
Create a GUI executable file created with tkinter
GUI image cropping tool made with Python + Tkinter
[Python] How to read excel file with pandas
Convert svg file to png / ico with Python
Python (Windows 10) Virtual Environment / Package with VS Code