Under window system release:
First, install pyinstaller
cmd installation command:
pip install pyinstaller
#前提得安装了pip,如果未安装请先安装pip,如果提示需要pip更新,更新pip
Two, python packaged (with no parameters)
File naming convention: do not support the Chinese command python files;
Path: recommended path without Chinese directory;
Command: pyinstaller -F filename (suffix py)
#命令语法:pyinstaller -F 文件名(带后缀py)
#常用参数说明:
#–icon=图标路径
#-F 打包成一个exe文件
#-w 使用窗口,无控制台
#-c 使用控制台,无窗口
#-D 创建一个目录,里面包含exe以及其他一些依赖性文件
#pyinstaller -h 来查看参数
#将cmd的目录切换至(命令:cd 文件路径(注意空格))需要打包的py文件目录下:
#有命令窗口弹出
pyinstaller -F shjys_rjjqk.py
#无命令窗口弹出
pyinstaller -F -w shjys_rjjqk.py
#或者
pyinstaller -F shjys_rjjqk.py --noconsole
Third, view the generated files
Four, pyinstaller change the icon of a program to generate exe
# my.ico 是一个图标名,和当前的shjys_rjjqk.py文件在同一个目录下
pyinstaller -F --icon=my.ico shjys_rjjqk.py
V. generate EXE (parameters)
py in obtaining external parameters:
Method 1: args input parameters before running (can not be entered in the black box exe may be performed by cmd window: shrjj.py 20180119);
Method 2: input parameter is an input (the black boxes can be entered in the exe) running;
Get recommendations with input;
NOTE: The method of the args argument (input parameters before running) packaged into exe, using bat batch to call, passing parameters;
Note: In the case of calls to the external configuration file, it is necessary to use an absolute path; otherwise the package, there will not find the configuration file;
Author: Man Integration
link: http://www.cnblogs.com/lizm166/p/8315468.html
Source: garden blog
copyright reserved by the authors. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.