python pyinstaller生成exe
1.pyinstaller
pip安裝即可
pip install pyinstaller
參數:
-F 指定打包後只生成一個exe格式的文件
-D –onedir 創建一個目錄,包含exe文件,但會依賴很多文件(默認選項)
-c –console, –nowindowed 使用控制檯,無界面(默認)
-w –windowed, –noconsole 使用窗口,無控制檯
-p 添加搜索路徑,以分號分割,讓其找到對應的庫。
-i 改變生成程序的icon圖標
命令:
`pyinstaller -F -p 包路徑(一般爲python安裝目錄/Lib/site-packages); test.py
2.問題
問題(1)
AttributeError: ‘str’ object has no attribute ‘items’
解決
pip install -U --pre setuptools
問題(2)
PermissionError: [Errno 13] Permission denied: '
解決
用管理員身份運行