0

我有一个 wxPython 应用程序,我正在尝试使用 py2exe 将它制作成一个 exe,但我遇到了一些麻烦。我MSVCP90.dll与脚本位于同一目录中,py2exe 完成后,它在启动 exe 时显示“程序无法启动,因为 MSVCR90.dll 丢失......”。为什么找不到呢?

虽然它是 py2exe'ing,但我还得到以下信息:

The following modules appear to be missing
['Carbon', 'Carbon.Files']
...
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.
...
  OLEAUT32.dll - C:\PATH
  USER32.dll - C:\PATH
...
  MSVCP90.dll - C:\PathToTheDllInMyScriptsFolder

我在这里缺少什么吗?将 .py wxPython 应用程序转换为 .exe wxPython 应用程序有多难?

4

4 回答 4

3

我对 py2exe 也有类似的问题。我的项目使用额外的库,如 wxPython 和 Requests。

这对我有用:

  1. 使用 gui2exe 创建项目

  2. 指定非常基本的设置,如目标类和数据文件(在我的情况下 - 图像、sqlite 数据库等)并编译项目。

  3. dist目录中,您将找到应该在我们的机器上运行的编译项目。

  4. 接下来的步骤是这两个教程的混合:py2execx_freeze

  5. dist创建目录Microsoft.VC90.CRT

  6. 复制到这个目录文件msvcm90.dll,,,从msvcp90.dllmsvcr90.dllC:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375

  7. 也复制C:\WINDOWS\WinSxS\Manifests\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375.manifest,但重命名为Microsoft.VC90.CRT.manifest

    我已经使用 Win XP 32 位和 Python 2.7.3 完成了这项工作,并在另一台 xp 机器和 Windows 7 上成功启动了编译的应用程序。

于 2012-10-28T00:29:26.980 回答
2

你有任何尝试pyinstaller的愿望吗?我也曾为 wxPython 项目尝试过 py2exe,但收到了许多晦涩难懂的错误。Pyinstaller 在第一次尝试时就出现了,我认为它更容易。

于 2012-10-19T06:58:38.770 回答
2

经过近一年的尝试建立一个没有成功。终于明白了。您必须排除两个文件“msvcp90.dll”、“msvcr71.dll”。

dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll', 'msvcp90.dll', 'msvcr71.dll']

于 2014-10-08T17:39:35.770 回答
1

处理这个问题的方法是从 py2exe 包中排除 MSVCP90.dll。这是我执行此操作的设置脚本之一的一部分:

dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
                'tk84.dll','MSVCP90.dll']

setup(
    data_files = data_files,
    options = {"py2exe": {"compressed": 2,
                          "optimize": 2,
                          "includes": includes,
                          "excludes": excludes,
                          "packages": packages,
                          "dll_excludes": dll_excludes,
                          "bundle_files": 1,
                          "dist_dir": "dist",
                          "xref": False,
                          "skip_archive": False,
                          "ascii": False,
                          "custom_boot_script": '',
                         }
              },
    zipfile = None,
    windows = [filename]
    )

然后,您将负责确保 MS Visual C++ 运行时安装在最终用户的机器上。你可以在这里得到它:

http://www.microsoft.com/en-us/download/details.aspx?id=29

我的经验是,很难找到缺少 Visual c 运行时的 Windows 机器,但您需要做好准备以防万一。

祝你好运,迈克

于 2012-10-20T18:27:18.417 回答