【问题标题】:PyInstaller on Windows 7 with Python 3带有 Python 3 的 Windows 7 上的 PyInstaller
【发布时间】:2017-10-29 15:32:54
【问题描述】:

我一直在 python2 中使用 pyinstaller 没有问题

现在我已经升级到 python 3 我遇到了问题

我在 Windows 7 上使用 Python 3.6 和 pyinstaller 3.3

当我运行 pyi-biuld 时,该过程完成并构建了一个 dist 目录。 exe启动然后崩溃。

我注意到dist目录下有个python27.dll

我可以做些什么来追踪正在发生的事情吗?

这是一个最小程序的 pyi-build 输出

(wenv35) C:\test_pyi>pyi-build foo.spec
46 INFO: Testing for ability to set icons, version resources...
92 INFO: ... resource update available
108 INFO: UPX is not available.
123 INFO: Processing hook hook-os
279 INFO: Processing hook hook-time
296 INFO: Processing hook hook-cPickle
389 INFO: Processing hook hook-_sre
546 INFO: Processing hook hook-cStringIO
669 INFO: Processing hook hook-encodings
701 INFO: Processing hook hook-codecs
1184 INFO: Extending PYTHONPATH with C:\test_pyi
1200 INFO: checking Analysis
1263 INFO: checking PYZ
1293 INFO: checking PKG
1309 INFO: building because C:\test_pyi\build\foo\foo.exe.manifest changed
1309 INFO: building PKG (CArchive) out00-PKG.pkg
1340 INFO: checking EXE
1340 INFO: rebuilding out00-EXE.toc because foo.exe missing
1340 INFO: building EXE from out00-EXE.toc
1340 INFO: Appending archive to EXE C:\test_pyi\dist\foo.exe
1761 INFO: checking COLLECT
1761 INFO: building COLLECT out00-COLLECT.toc

我现在收到一个致命错误对话框:

加载 Python DLL 时出错: C:\ ......\python27.dll (错误代码 126)

【问题讨论】:

  • 任何错误或警告?
  • 没有。没有什么。从 python 运行时,该应用程序运行完美。有什么可以建议的痕迹吗?
  • 你能发布你的 pyinstaller 命令的输出吗
  • @The4thIceman 我已经编辑了我的问题
  • PYTHONPATH 是否指向 python 3.6?看起来 pyinstaller 正在抓取旧的 python。虽然不确定

标签: python-3.x windows-7 pyinstaller


【解决方案1】:

PyInstaller 似乎还不支持 Python 3.6:https://github.com/pyinstaller/pyinstaller/issues/2286

通常,这会在编译时导致错误,但我想如果您的计算机上安装了两个版本的 Python,它会以某种方式找到 2.7 并将其打包,这会导致您的 exe 无法正常运行(你的 python 3.6 代码和 python 2.7 dll 不匹配)

您可能必须为此降级到 3.5...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-18
    • 2020-02-21
    • 1970-01-01
    • 2013-03-04
    • 1970-01-01
    • 2023-04-07
    相关资源
    最近更新 更多