pyinstaller3.4打包python为exe文件遇到的问题

1、AttributeError: module 'enum' has no attribute 'IntFlag'

【可能原因】:这可能是由包enum34引起的。 从python 3.4开始,有一个标准的库enum模块,所以你应该卸载enum34,它不再与标准库中的枚举兼容,因为在python 3.6中添加了enum.IntFlag.

【解决方法】:卸载enum34.  pip uninstall enum34

 

2、ModuleNotFoundError: No module named 'setuptools._vendor'

【可能原因】:找不到与setuptools._vendor有关的信息,感觉和setuptools本身的版本有关。

【解决方法】:使用pip install --upgrade setuptools

或者:python -m pip install --upgrade --extra-index-url https://pypi.tuna.tsinghua.edu.cn/simple setuptools

 

3、WARNING: Unable to find Qt5 translations C:/qt5b/qt_1524647842210/_h_env/Library/translations\qtbase_*.qm. These translations were not packaged.

【可能原因】:Conda 4.5.11, Python 3.6.4, PyInstaller 3.4

插件路径在hooks / qt.py中未正确确定。 Qt要求在任何其他调用之前首先实例化QCoreApplication。

My qt.py hook is in ~\anaconda3\Lib\site-packages\PyInstaller\utils\hooks\qt.py

找到下面的内容位置,替换为下面的内容。

    json_str = exec_statement("""
        import sys

        # exec_statement only captures stdout. If there are
        # errors, capture them to stdout so they can be displayed to the
        # user. Do this early, in case PyQt5 imports produce stderr
        # output.
        sys.stderr = sys.stdout

        import json
        from %s.QtCore import QLibraryInfo, QCoreApplication

        # QLibraryInfo isn't always valid until a QCoreApplication is
        # instantiated.
        app = QCoreApplication([])
        paths = [x for x in dir(QLibraryInfo) if x.endswith('Path')]
        location = {x: QLibraryInfo.location(getattr(QLibraryInfo, x))
                    for x in paths}
        try:
            version = QLibraryInfo.version().segments()
        except AttributeError:
            version = None
        print(str(json.dumps({
            'isDebugBuild': QLibraryInfo.isDebugBuild(),
            'version': version,
            'location': location,
        })))
    """ % self.namespace)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值