部署Python程序的问题(与py2exe一起打包)

时间:2021-05-17 07:14:22

I have a problem: I used py2exe for my program, and it worked on my computer. I packaged it with Inno Setup (still worked on my computer), but when I sent it to a different computer, I got the following error when trying to run the application: "CreateProcess failed; code 14001." The app won't run. (Note: I am using wxPython and the multiprocessing module in my program.) I googled for it a bit and found that the the user should install some MS redistributable something, but I don't want to make life complicated for my users. Is there a solution?

我有一个问题:我使用py2exe作为我的程序,它在我的计算机上工作。我用Inno Setup打包它(仍在我的计算机上工作),但是当我将它发送到另一台计算机时,我在尝试运行应用程序时遇到以下错误:“CreateProcess失败;代码14001”。该应用程序将无法运行。 (注意:我在我的程序中使用wxPython和多处理模块。)我搜索了一下,发现用户应该安装一些MS可再发行的东西,但我不想让我的用户生活变得复杂。有解决方案吗?

Versions:

Python 2.6.2c1, py2exe 0.6.9, Windows XP Pro

Python 2.6.2c1,py2exe 0.6.9,Windows XP Pro

4 个解决方案

#1


You need to include msvcr90.dll, Microsoft.VC90.CRT.manifest, and python.exe.manifest (renamed to [yourappname].exe.manifest) in your install directory. These files will be in the Python26 directory on your system if you installed Python with the "Just for me" option.

您需要在安装目录中包含msvcr90.dll,Microsoft.VC90.CRT.manifest和python.exe.manifest(重命名为[yourappname] .exe.manifest)。如果您使用“Just for me”选项安装Python,这些文件将位于系统的Python26目录中。

Instructions for doing this can be found here.

可以在此处找到执行此操作的说明。

Don't forget to call multiprocessing.freeze_support() in your main function also, or you will have problems when you start a new process.

不要忘记在主函数中调用multiprocessing.freeze_support(),否则在启动新进程时会遇到问题。

While others have discussed including the MSVC runtime in your install package, the above solution works when you only want to distribute a single .zip file containing all your files. It avoids having to create a separate install package when you don't want that additional complication.

虽然其他人已经讨论过在您的安装包中包含MSVC运行时,但只需要分发包含所有文件的单个.zip文件时,上述解决方案就可以运行。当您不需要额外的复杂功能时,它可以避免创建单独的安装包。

#2


You should be able to install that MS redistributable thingy as a part of your InnoSetup setup exe.

您应该能够将该MS可再发行组件安装为InnoSetup安装程序的一部分。

#3


When you run py2exe, look closely at the final messages when it's completed. It gives you a list of DLLs that it says are needed by the program, but that py2exe doesn't automatically bundle.

运行py2exe时,请在完成后仔细查看最终消息。它为您提供了程序所需的DLL列表,但py2exe不会自动捆绑。

Many in the list are reliably available on any Windows install, but there will be a few that you should manually bundle into your Inno Setup installation. Some are only needed if you want to deploy on older Windows installs e.g. Win 2000 or earlier.

列表中的许多可以在任何Windows安装上可靠地使用,但是您应该手动将其捆绑到Inno Setup安装中。只有在想要在较旧的Windows安装上部署时才需要一些例如赢得2000或更早。

#4


You can ship the runtime DLLs in question with your application as a "private assembly". This simply means putting a copy of a specially-named directory containing the runtime DLLs and their manifests alongside your executable.

您可以将应用程序中的运行时DLL作为“私有程序集”发送。这只是意味着将包含运行时DLL及其清单的特殊命名目录的副本放在可执行文件旁边。

See my answer to this post.

请参阅我对这篇文章的回答。

#1


You need to include msvcr90.dll, Microsoft.VC90.CRT.manifest, and python.exe.manifest (renamed to [yourappname].exe.manifest) in your install directory. These files will be in the Python26 directory on your system if you installed Python with the "Just for me" option.

您需要在安装目录中包含msvcr90.dll,Microsoft.VC90.CRT.manifest和python.exe.manifest(重命名为[yourappname] .exe.manifest)。如果您使用“Just for me”选项安装Python,这些文件将位于系统的Python26目录中。

Instructions for doing this can be found here.

可以在此处找到执行此操作的说明。

Don't forget to call multiprocessing.freeze_support() in your main function also, or you will have problems when you start a new process.

不要忘记在主函数中调用multiprocessing.freeze_support(),否则在启动新进程时会遇到问题。

While others have discussed including the MSVC runtime in your install package, the above solution works when you only want to distribute a single .zip file containing all your files. It avoids having to create a separate install package when you don't want that additional complication.

虽然其他人已经讨论过在您的安装包中包含MSVC运行时,但只需要分发包含所有文件的单个.zip文件时,上述解决方案就可以运行。当您不需要额外的复杂功能时,它可以避免创建单独的安装包。

#2


You should be able to install that MS redistributable thingy as a part of your InnoSetup setup exe.

您应该能够将该MS可再发行组件安装为InnoSetup安装程序的一部分。

#3


When you run py2exe, look closely at the final messages when it's completed. It gives you a list of DLLs that it says are needed by the program, but that py2exe doesn't automatically bundle.

运行py2exe时,请在完成后仔细查看最终消息。它为您提供了程序所需的DLL列表,但py2exe不会自动捆绑。

Many in the list are reliably available on any Windows install, but there will be a few that you should manually bundle into your Inno Setup installation. Some are only needed if you want to deploy on older Windows installs e.g. Win 2000 or earlier.

列表中的许多可以在任何Windows安装上可靠地使用,但是您应该手动将其捆绑到Inno Setup安装中。只有在想要在较旧的Windows安装上部署时才需要一些例如赢得2000或更早。

#4


You can ship the runtime DLLs in question with your application as a "private assembly". This simply means putting a copy of a specially-named directory containing the runtime DLLs and their manifests alongside your executable.

您可以将应用程序中的运行时DLL作为“私有程序集”发送。这只是意味着将包含运行时DLL及其清单的特殊命名目录的副本放在可执行文件旁边。

See my answer to this post.

请参阅我对这篇文章的回答。