Python 使用py2exe时遇到问题
所以我想制作一个exe文件。我使用的是Python2.7,据我所知,我已经安装了py2exe的正确版本。我已经编写了一个简单的setup.py代码来创建exe文件 但是,当我运行它时,我得到了错误: 错误:MSVCP90.dll:没有这样的文件或目录 现在,我尝试用两种方法解决这个问题:Python 使用py2exe时遇到问题,python,executable,py2exe,Python,Executable,Py2exe,所以我想制作一个exe文件。我使用的是Python2.7,据我所知,我已经安装了py2exe的正确版本。我已经编写了一个简单的setup.py代码来创建exe文件 但是,当我运行它时,我得到了错误: 错误:MSVCP90.dll:没有这样的文件或目录 现在,我尝试用两种方法解决这个问题: 我安装了MSVCP90.dll文件,并将其与python27 dll一起放入,然后运行安装程序。这成功地创建了一个可执行文件。但是,当我试图运行可执行文件时,它说: 程序无法启动,因为您的计算机中缺少MSVCR
有人知道我能做些什么来让这个可执行文件工作吗?正如您在评论中提到的,您正在使用wxpython。我对wxpython和py2exe也有同样的问题。我通过将MSVCP90.dll的清单添加到exe文件中解决了这个问题。尝试将这些行添加到setup.py,然后查看它是否有效
manifest = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="5.0.0.0"
processorArchitecture="x86"
name="%(prog)s"
type="win32"
/>
<description>%(prog)s</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>"""
...
windows = [{"script":"myscript.pyw",'other_resources': [(24,1,manifest)]}]
manifest=”“”
%(进步)s
"""
...
windows=[{“脚本”:“myscript.pyw”,'other_resources':[(24,1,manifest)]]
正如您在评论中提到的,您正在使用wxpython。我对wxpython和py2exe也有同样的问题。我通过将MSVCP90.dll的清单添加到exe文件中解决了这个问题。尝试将这些行添加到setup.py,然后查看它是否有效
manifest = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="5.0.0.0"
processorArchitecture="x86"
name="%(prog)s"
type="win32"
/>
<description>%(prog)s</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>"""
...
windows = [{"script":"myscript.pyw",'other_resources': [(24,1,manifest)]}]
manifest=”“”
%(进步)s
"""
...
windows=[{“脚本”:“myscript.pyw”,'other_resources':[(24,1,manifest)]]
作为一种鸟枪式方法,在将MSVCP90.dll与Python27 dll放在一起后是否重新启动了?是的,我现在刚刚尝试过,但没有解决任何问题。我感到困惑。您的错误是针对不同的dll“R90.dll”,但您所说的是“P90.dll”。是的,我知道。我也不明白!嗯,如果有什么不同的话,我的代码中也使用了wxpython库。作为一种散弹枪方法,你在将MSVCP90.dll与Python27 dll放在一起后重新启动了吗?是的,我刚刚尝试过,但没有解决任何问题。我很困惑。您的错误是针对不同的dll“R90.dll”,但您所说的是“P90.dll”。是的,我知道。我也不明白!嗯,如果有什么不同的话,我在代码中也使用了wxpython库。