由 pywin32 生成的 python 可执行文件中的 dll 加载错误
我使用 py2exe 使用 64 位 python 解释器和 32 位 python 解释器创建了 python 可执行文件。
在我的程序中,我使用模块 pywin32 com,因此我在创建可执行文件之前下载并安装了该程序的 64 位和 32 位版本。
64位exe工作正常,但32位exe有以下问题:
Traceback (most recent call last):
File "program.py", line 11, in <module>
File "win32com\__init__.pyc", line 5, in <module>
File "win32api.pyc", line 12, in <module>
File "win32api.pyc", line 10, in __load
ImportError: DLL load failed: The specified procedure could not be found.
我通过直接运行源代码尝试了两个版本,即python program.py
和C:\python_32\python.exe program.py
两者都工作正常。
注意我在 64 位 Windows 7 计算机上测试了 64 位 exe,在 32 位 Windows XP 计算机上测试了 32 位 exe。
I created python executables with py2exe with both 64bit python interpreter and 32 bit python interpreter.
In my program, I use the module pywin32 com
, and so I dl'ed and installed both the 64bit and 32bit versions of the program prior to creating the executable.
The 64bit exe works fine, but the 32 bit one has the following problem:
Traceback (most recent call last):
File "program.py", line 11, in <module>
File "win32com\__init__.pyc", line 5, in <module>
File "win32api.pyc", line 12, in <module>
File "win32api.pyc", line 10, in __load
ImportError: DLL load failed: The specified procedure could not be found.
I tried both versions by running the source directly, ie python program.py
and C:\python_32\python.exe program.py
and both work fine.
Note I tested the 64bit exe on a 64bit windows 7 computer and the 32bit exe on a 32bit windows XP computer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
比以往任何时候都古老,但我今天偶然发现了这个问题,如果其他人这样做,我运行的是:
从命令行(更改值) python /c/Python26/Scripts/pywin32_postinstall.py -install适合)。有效:(
在 WinXP SP3 上)
Older than everything ever, but I stumbled on this problem today, and if anyone else does, what I ran was:
python /c/Python26/Scripts/pywin32_postinstall.py -install
from the commandline (change values to fit). That worked:(On WinXP SP3)
在 Windows2008 R2 服务器上安装 ArcGIS 后(试图集中我们的脚本),我的 python27 pywin32 安装出现了上述错误。
发现对我来说,我必须启动一个以管理员身份运行的命令行窗口(右键单击以在 Windows 中获取该选项),然后从
c:\arcpy27\arcgis10.1>python c 运行以下命令行:/arcpy27/arcgis10.1/scripts/pywin32_postinstall.py -install
我看到很多人都遇到了这个问题,我尝试了多种方法,但是这个最终是成功安装 pywin32 的解决方案。
非常感谢您的解决方案。在我最终遇到您的解决方案并根据我的版本修改它之前,我进行了几次安装和卸载。
Had the above noted errors with my python27 pywin32 installation that got installed after my installation of ArcGIS on a windows2008 R2 server (trying to centralize our scripts).
Found that for me, I had to start a command line window with run as adminstrator (right click to get that option in windows) and then run the following command line from the
c:\arcpy27\arcgis10.1>python c:/arcpy27/arcgis10.1/scripts/pywin32_postinstall.py -install
I see a lot of people have run into this issue and I tried multiple things, but this was finally the solution that managed to get pywin32 installed.
Thanks so much for your solution. Took me a couple of install and uninstalls before I finally ran across your solution and modified it for my version.