I have tried to package Python scripts with pyinstall before, but I encountered many problems in the process of using pyinstall, such as too large volume of packaged files, too many irrelevant files in the root directory of packaged programs, and so on.
So instead of pyinstaller, I use cxfree to package Python scripts. Without saying much, let’s get to the point.
1. Install CX_ Freeze:
The version of Python I use is 3.8.8. I can install CX directly with pypi_ Freeze。
Command: PIP install CX_ Freeze
CX installed_ The version of freeze is 6.6. After installation, you can start to package the script. Let’s simply create a script file for packaging.
hello.py:
import datetime
Print (‘Hello, the current date and time are: ‘, datetime. Datetime. Now())
input()
I store this script in the pinstar folder under disk D
Next, we introduce two ways to package the above script as. Exe
First, after win + R, enter CMD to enter the command line, and then CD C: Enter the scripts directory in the python installation path.
Here, the path following the CD is the installation path of Python in my computer. Just replace this path with the path of Python in my computer. For example, if anaconda is used, the path can be changed to the path of scripts folder under anaconda.
After the path is switched, use the command cxfree D:: (pinstarr) Hello. Py — target dir D:: (pinstarr) dist, and press enter
Read More:
- Can’t find Python executable “D:\python3\python.exe”, you can set the PYTHON env variable.
- Add executable permissions to Linux files
- Package python3.1 + PyQt4 into exe
- Python – annotate and uncomment multiline programs
- Solve the problem of unable to locate package python3.6 when upgrading from python3.5 to python3.6 in ubantu16.04
- The problem of failed to create process occurs in pyinstaller package program of Python
- (Copy python package, the problem generated) pip Fatal error in launcher: Unable to create process using
- NPM run build failed to package err! Missing script: build
- Error in pyinstall package Python program: jinja2.exceptions.templatenotfound: Chart_ Solution to component.html
- Making Python script into exe command under Windows
- Vue3 uses webpack bundle analyzer to analyze package files
- Failed to download package files error after re installing Ubuntu
- Error running docker container: starting container process caused “exec: \“python\“: executable file
- The remote port occupation of Linux startup jar package script reports an error
- The python script tool of ArcGIS reports an error: indentationerror: unexpected indent solution
- Package summary of installing python with CONDA
- Idea Maven project uses package to package and report error (package does not exist)
- Cuban DCOM connection to programs Synsopose.exe failed
- Unity3d mount script error “can’t add script behavior TMP”_ CoroutineTween. …”
- CentOS solves the problem of modulenotfounderror when salt calls python3 script remotely, and solves the problem that PIP3 module cannot be shared by different users