美文网首页程序员
#Python3#打包成exe

#Python3#打包成exe

作者: AlanSS | 来源:发表于2018-12-04 15:50 被阅读32次

1.安装pyinstaller

PyInstaller Quickstart

Install PyInstaller from PyPI:

pip install pyinstaller

Go to your program’s directory and run:

pyinstaller yourprogram.py

This will generate the bundle in a subdirectory called dist.

link

2.打包成一个exe文件

pyinstaller yourprogram.py这个命令是基础的打包命令,会将py文件打包成依赖多个dll文件的exe文件。

想要打包成单一的exe文件需要用到下面的命令:

pyinstaller --onefile  yourprogram.py

中间位置可以用到的参数如下表:

修改exe的图标:

pyinstaller --onefile  --icon=C:\ico\icon.ico   yourprogram.py

(其中C:\ico\icon.ico为图标地址)

相关文章

网友评论

    本文标题:#Python3#打包成exe

    本文链接:https://www.haomeiwen.com/subject/cbtvcqtx.html