azeqjz Python Notes


使用pyinstaller打包python程序为exe(not work well)

azeqjz
azeqjz
Jul 23, 2017 · 1 min read

step 1 官网下载安装64位的python https://www.python.org/downloads/

step 2 安装的时候勾选add to path

step 3 cmd界面输入pip list和python校验是否可以。

step 4 执行pip install pyinstaller安装pyinstaller。或者 pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

step 5 pyinstaller -F -w --icon=”output.ico” QueryIp.py

参数解释:

-F 注意指令区分大小写。这里是大写。使用-F指令可以把应用打包成一个独立的exe文件,否则是一个带各种dll和依赖文件的文件夹

-w 屏蔽带命令行的调试窗口(黑窗口)

–icon 应用程序图标路径

执行完毕之后会发现多出来两个文件夹,其中单文件exe就存放在dist目录下

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade