zoukankan      html  css  js  c++  java
  • pyinstaller发布exe,弹出Failed to execute script main

    1.在PyCharm中按Alt+F12打开Terminal对话框

    1.1我的项目文件放在wxpython目录下,D:learnWeather index insurancewxpython>pyinstaller -F -w teaindex_main.py 

    1.2运行结束后在D:learnWeather index insurancewxpython目录下生成dist文件夹和build文件夹,我的exe程序在dist文件夹下,双击exe弹出:

    1.3重新在Terminal对话框中,运行D:learnWeather index insurancewxpython>pyinstaller -F -c teaindex_main.py ,运行exe,可以看到问题所在,缺少module typedefs

    应该使用:pyinstaller -F -c demo.py  此时打包完成后,点击exe执行文件,如果有报错的话,将在控制台显示。这是,要做好截图的准备,因为控制台报错后是一闪而过的。

    1.4查阅网上的解决方法

    将打包代码改成:

    D:learnWeather index insurancewxpython>pyinstaller -F -c teaindex_main.py --hidden-import sklearn.neighbors.typedefs

    问题解决了!成功生成可以运行的exe文件

    1.5生成带图标的程序D:learnWeather index insurancewxpython>pyinstaller -F -w -i sunny.ico teaindex_main.py --hidden-import sklearn.neighbors.typedefs

     1.6在打包时会出现问题Cannot find existing PyQt5 plugin directories ,具体截图如下

    解决办法:

    • 用everything搜索PyQt5,找到 /Library/plugins路径下的PyQt5文件夹,将里面的dll动态库pyqt5qmlplugin.dll复制出来
    • 按照错误提示的路径,一个个的新建文件夹,形成目录C:qt5bqt_1524647842210\_h_envLibraryplugins,将刚才复制出来的dll动态库拷贝进去即可

    1.7 如果除了缺少上面那个模块,还缺少No module named 'sklearn.utils._cython_blas',在最后加上这个模块如下所示。

    pyinstaller -F -w teaindex_main.py --hidden-import sklearn.neighbors.typedefs --hidden-import sklearn.utils._cython_blas

  • 相关阅读:
    C# send mail with outlook and word mailmerge
    The ‘Microsoft.ACE.OLEDB.12.0′ provider is not registered on the local machine. (System.Data)
    显示数据库中所有表的记录数
    Transaction Log Truncation
    To change the sharepoint CA port
    sharepoint One-Time Passwords (windows basic authentication)
    Multi-Device Hybrid Apps (Preview)
    0ffice365 Calendar API
    angular service/directive
    MySql安装图解
  • 原文地址:https://www.cnblogs.com/suncf/p/10974905.html
Copyright © 2011-2022 走看看