python3.x cxfreeze to use .p packaged into .exe

Before writing a batch using ffplay view h264 format images to be open after each frame is drawn pycharm compiler to run the program before you can view images correctly, or run other computer does not install python environment, very convenient . For this reason, the Internet to find some method of discovery is to say little knowledge. Therefore, how to put themselves under python3.x package .py files into .exe executable file, so that you can directly modify the number of pictures in the file you can double-click the .exe program to view pictures recorded by practice.

 

A, .py packaged as .exe common tools

1、py2exe   

Download: http: //www.py2exe.org/

2、cxfreeze

Download: https: //anthony-tuininga.github.io/cx_Freeze/

3、PyInstaller 

Download: http: //www.pyinstaller.org/

These tools, such as not properly asked, agreed to Baidu search download directly to the computer version, I pro-test, these three tools currently support only cxfreeze package of python3

 

Second, download and install cxfreeze

1, enter cxfreeze official website, here I downloaded py36 for the cxfreeze 64-bit version, as shown below

2, installation cxfreeze

Pip tool into the page, python3.x comes with (python2.x own installation required), for the installation instructions: pip install cxfreeze installation package, as FIG.

It appears successfully the installation was successful.

3, after viewing the installation directory contains the following three files

 

Third, a packed instruction execution cxfreeze

1, there is a pit (directly cxfreeze .py file path, prompts cxfreeze not internal or external command), as shown below

The solution is: write a bat file can be solved, this method is known from almost Gangster https://www.zhihu.com/question/41211581

2, the detailed steps to solve: a new txt file, write the following script

然后重新另存为cxfreeze.bat即可,同cxfreeze、cxfreeze-postinstall、cxfreeze-quickstart同个目录下,即

3、查看cxfreeze是否还提示不是内部或外部命令的错误,在cxfreeze目录下输入cmd,执行指令:cxfreeze -h,提示如下图即成功

4、这里我们根据

来设置需要转换的文件的路径:(--init-script=后接绝对路径)

这里输入:cxfreeze --init-script=D:\python\python3.6.1\Scripts\python_ff.py python_ff.py,然后按回车键即可看到打包过程

 

四、运行查看打包成功后的.exe程序

1、在cxfreeze路径下会生成一个dist文件夹,点击进入即可查看到打包成功后的.exe应用程序,如下图

2、双击python_ff.exe的运行结果如下图所示

后续只需要修改photo文件夹下的图片即可快速查看h264格式的图片文件

Guess you like

Origin www.cnblogs.com/valorchang/p/11357410.html