【问题标题】:PyInstaller Runtime Error? (R6034)PyInstaller 运行时错误? (R6034)
【发布时间】:2018-12-07 06:05:46
【问题描述】:

我终于让 PyInstaller 构建了一个 exe 文件,但它没有运行。我一打开它,就会在一个对话框中看到它:

Runtime Error!
Program C:\.....\MCManager.exe

R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.

这是我的规格:

# -*- mode: python -*-
a = Analysis(['MCManager.py'],
             pathex=['C:\\Users\\Lucas\\Dropbox'],
             hiddenimports=[],
             hookspath=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name=os.path.join('dist', 'MCManager.exe'),
          debug=False,
          strip=None,
          upx=True,
          console=False,
          icon='MCManager.ico')
app = BUNDLE(exe,
             name=os.path.join('dist', 'MCManager.exe.app'))

我环顾四周,似乎没有人有同样的问题。

如果它改变了一些东西,这个脚本使用 wxPython。

【问题讨论】:

  • 我在使用 pyinstaller 3.2 和 python 2.7.11 时遇到了同样的问题。回到 pyinstaller 3.1 解决了这个问题 :)

标签: python pyinstaller


【解决方案1】:

我打算发表评论,但没有足够的代表。虽然前段时间有人问过这个问题,但我最近遇到了同样的问题,结果证明是 3.2 版的 Pyinstaller 错误。

升级到 pyinstaller 3.2 后,生成的 exe 以 R6034 终止: https://github.com/pyinstaller/pyinstaller/issues/1985

PyInstaller 3.2、OneFile R6034、32 位 Python 2.7.11 https://github.com/pyinstaller/pyinstaller/issues/2042

看起来他们已经在最新的开发版本中修复了这个问题,建议

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

在我的需求文件中使用它而不是 pyinstaller==3.2 为我修补了它!

【讨论】:

  • 这对我有用,所以在某些情况下至少它是正确的答案!
  • 目前答案正确。
【解决方案2】:

我最近开始收到“运行时错误?(R6034)” 它位于一个可靠的现有 python 程序上,我之前使用 pyinstaller 编译为一个文件。我注意到这个问题只发生在我在编译后重命名 exe 之后。一旦我将它重命名为原来的 exe 名称,R6034 就消失了。

经验教训...不要在使用 pyinstaller 构建后重命名您的 exe。如果你需要你的 exe 有一个不同的名字,那么改变源 py 名字然后重新编译。

【讨论】:

  • 这是我从 PyInstaller 2.1 切换到 3.4 后 R6034 出现问题的原因。实际上,重命名 exe 是非常好的,但是当你这样做时,你还需要重命名 MANIFEST! PI为您生成一个清单,以解决运行时加载的 VC 再分发 dll。 Windows 要求 exe 和清单共享一个基本名称,以便它们关联并尊重清单。
【解决方案3】:

这似乎是类似的问题https://github.com/pyinstaller/pyinstaller/issues/689

看看您是否可以使用该解决方法:

我能够通过使用 onedir 选项而不是 onefile,然后只需移动清单 到包含单文件可执行文件的目录,它允许 它可以工作。

似乎他们正在 3.0 中修复它

【讨论】:

  • 我现在也有同样的问题,使用 onedir 也适用于我。但是我正在开发 pyinstaller 的开发人员版本,所以它似乎没有被修复。
【解决方案4】:

我有同样的问题,没有重命名任何东西,我只是构建了 -F 并在 3.2 版中崩溃,但是在 2.1 版中不会出现此错误。

链接: https://github.com/pyinstaller/pyinstaller/releases/download/v2.1/PyInstaller-2.1.zip

我的建议? pip 卸载 pyinstaller 之后,您应该安装 2.1 版并准备好再次运行。 ./setup.py 构建 ./setup.py 安装

祝你好运

【讨论】:

    【解决方案5】:

    如果您在 pyinstaller 构建的 exe 中调用 popen,也会发生此错误。要修复此错误,您必须为 popen 调用的 stdout 使用显式文件句柄,如下例所示。

    import sys
    import subprocess
    from PyQt4 import QtGui
    
    def verify_license():
        tmp_file = '.license_output'
    
        try:
            with open(tmp_file, 'w+') as file_obj:
                proc = subprocess.Popen(['echo', 'hi'], shell=True,
                                        stdout=file_obj, stderr=subprocess.STDOUT,
                                        stdin=subprocess.PIPE)
                ret = proc.wait()
    
            if ret != 0:
                sys.exit(-1)
    
            with open(tmp_file, 'r') as file_obj:
                output = file_obj.read()
    
        except Exception as err:
            sys.exit(-1)
    
        if 'hi' not in output:
            raise Exception('bad news: output was %s' % (output))
    
    
    def main():
        app = QtGui.QApplication(sys.argv)
    
        w = QtGui.QWidget()
        w.resize(250, 150)
        w.move(300, 300)
        w.setWindowTitle('Simple')
        w.show()
    
        sys.exit(app.exec_())
    
    
    if __name__ == '__main__':
        verify_license()
        main()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-23
      • 1970-01-01
      • 2013-01-11
      • 2019-06-27
      • 1970-01-01
      相关资源
      最近更新 更多