The exe file is an executable file that allows the PC to execute it as it is. Because it is an executable file, you only need to double-click it to start processing. In addition, the extension is ".exe", which is often used in the Windows environment. This document In this article, we will introduce how to make a Python script become an exe file running in the Windows environment.
Convert the program to an exe file
Let’s first introduce how to use the tool Pyinstaller
Install Pyinstaller
We use pip to install Pyinstaller.
Note that if you use Pyinstaller, you should use an environment with python 2.7 or python 3.3 to python 3.6 (as of July 2018).
The installation method is very simple, we execute the following command
$ pip install pyinstaller
Next we convert the python script into an exe file
We will ".py" Convert file to ".exe" file
First, we create the original ".py" file.
This time use the following file (test.py) that displays "Hello World!"
#! /usr/bin/env python # coding: UTF-8 print("Hello World!")
When converting, execute the following command.
$ pyinstaller test.py
You can see that the above test.py process has been completed.
Hello World!
This article ends here. For more exciting content, you can pay attention to other related column tutorials on the php Chinese website! ! !
The above is the detailed content of How to make a Python script an exe file that runs in a Windows environment. For more information, please follow other related articles on the PHP Chinese website!