pyinstaller發佈exe,彈出Failed to execute script main

1.在PyCharm中按Alt+F12打開Terminal對話框python

1.1個人項目文件放在wxpython目錄下,D:\learn\Weather index insurance\wxpython>pyinstaller -F -w teaindex_main.py ui

1.2運行結束後在D:\learn\Weather index insurance\wxpython目錄下生成dist文件夾和build文件夾,個人exe程序在dist文件夾下,雙擊exe彈出:blog

1.3從新在Terminal對話框中,運行D:\learn\Weather index insurance\wxpython>pyinstaller -F teaindex_main.py ,運行exe,能夠看到問題所在,缺乏module typedefsimport

1.4查閱網上的解決方法module

將打包代碼改爲:打包

D:\learn\Weather index insurance\wxpython>pyinstaller -F -w teaindex_main.py --hidden-import sklearn
.neighbors.typedefs程序

問題解決了!成功生成能夠運行的exe文件方法

1.5生成帶圖標的程序D:\learn\Weather index insurance\wxpython>pyinstaller -F -w -i sunny.ico teaindex_main.py --hidden-import sklearn.neighbors.typedefsim

相關文章
相關標籤/搜索