In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the ways to package python into exe", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "what are the ways to package python into exe"!
The most common way to package Python is through pyinstaller.
pip install pyinstaller
The above installation is relatively slow, with the following Tsinghua source fast.
#Qinghua source pip install pyinstaller -i https://pypi.tuna.tsinghua.edu.cn/simple/Detailed steps
pyinstaller is a command-line tool. Here are the detailed steps
1. cmd Switch to the directory of python files.
2. Execute the command pyinstaller -F -w -i python.ico watermark.py,
After execution, you will find 3 folders generated
The dist folder contains the exe files that we have packaged.
3. Double-click exe to run successfully.
detailed parameters
In the above packing command, several parameters are used: -F, -W, -i. The meanings of these parameters are as follows:
Parameter Usage-F The generated result is an exe file in which all third-party dependencies, resources, and code are packaged-D The generated result is a directory in which all third-party dependencies, resources, and exes are stored (default)-a does not contain unicode support-d When executing the generated exe, some logs will be output to help check errors-w Do not display the command line window-c Display the command line window (default)-p Specify additional import paths, Similar to using python path-i to specify icon-v to display the filename of.exe generated by version number-n
pyinstaller -F -w -i python.ico watermark.py means-F, packaging only generates an exe file, -w, does not open the command line window when running the program, -i is packaging the ico icon with its own settings.
Graphics window packaging
Some people may feel that command-line packaging also needs to remember the meaning of various parameters, there is no windowed packaging method, not to mention, really have. auto-py-to-exe A module that encapsulates pyinstaller as a GUI window.
pip install auto-py-to-exe -i https://pypi.tuna.tsinghua.edu.cn/simple/
After installation is complete, type `` on the command line to open the packaging window.
There are several parameters in the window:
Script Location: The path to a Python script.
Onefile (--onedir / --onefile): is the above-D and-F parameters, generate a single exe file or generate a folder
Console Window (--console / --windowed): The above-w and-c parameters indicate whether a command line window appears during operation.
ICON: is the address of the ico icon
After setting these parameters, the pyinstaller command will be displayed in the Current Command box below. Click the last button to generate the exe file.
At this point, I believe that everyone has a deeper understanding of "what are the ways python is packaged into exe", so you may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.