PyInstaller 的安装和使用(python生成exe文件)_联网安装

一、配置系统变量(安装时自动添加环境变量跳过此步

安装需要用到pip工具,该工具在3.5版本的python中已经自带不用另行安装,但是需要在系统变量中添加python下的Scripts文件夹,如下图: 

 

二、查找pyinstaller官网,寻找安装方法

http://www.pyinstaller.org/ 

pip install pyinstaller

三、安装可能遇到问题

1.需要更新pip再去安装 

python -m pip install --upgrade pip

 

 2.提示需要安装pywin32 

error: Could not find suitable distribution for Requirement.parse('pywin32-ctypes>=0.2.0')

https://pyinstaller.readthedocs.io/en/stable/ 

 

https://pypi.org/project/pypiwin32/219/ 

联网超时参考:https://blog.csdn.net/tscaxx/article/details/106865951

手动安装PyWin32参考:https://blog.csdn.net/tscaxx/article/details/106866332

四、使用

Windows OS下进入cmd(命令行窗口) 输入:(选择命令类型)

pyinstaller -F --icon=my.ico test.py #打包成exe,并设置图标
 
pyinstaller -F -w yourfilename.py #打包成exe,且不包含控制台
 
pyinstaller -F xx.py xxx.py ...... #打包多个python文件

注意:命令窗口所在的文件夹,最好在python文件所在的目录。

 https://blog.csdn.net/tscaxx/article/details/106904868

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章