由 pywin32 生成的 python 可执行文件中的 dll 加载错误

发布于 2024-11-15 20:31:39 字数 704 浏览 4 评论 0原文

我使用 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.pyC:\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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怪我入戏太深 2024-11-22 20:31:40

比以往任何时候都古老,但我今天偶然发现了这个问题,如果其他人这样做,我运行的是:

从命令行(更改值) python /c/Python26/Scripts/pywin32_postinstall.py -install适合)。有效:(

$ python /c/Python26/Scripts/pywin32_postinstall.py -install
Copied pythoncom26.dll to C:\WINDOWS\system32\pythoncom26.dll
Copied pythoncomloader26.dll to C:\WINDOWS\system32\pythoncomloader26.dll
Copied pywintypes26.dll to C:\WINDOWS\system32\pywintypes26.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\2.6\Help[None]=None
-> Software\Python\PythonCore\2.6\Help\PythonwinReference[None]='c:\\Python26\\Lib\\site-packages\\PyWin32.chm'
Pythonwin has been registered in context menu
Creating directory c:\Python26\Lib\site-packages\win32com\gen_py
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.`

在 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:

$ python /c/Python26/Scripts/pywin32_postinstall.py -install
Copied pythoncom26.dll to C:\WINDOWS\system32\pythoncom26.dll
Copied pythoncomloader26.dll to C:\WINDOWS\system32\pythoncomloader26.dll
Copied pywintypes26.dll to C:\WINDOWS\system32\pywintypes26.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\2.6\Help[None]=None
-> Software\Python\PythonCore\2.6\Help\PythonwinReference[None]='c:\\Python26\\Lib\\site-packages\\PyWin32.chm'
Pythonwin has been registered in context menu
Creating directory c:\Python26\Lib\site-packages\win32com\gen_py
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.`

(On WinXP SP3)

浅紫色的梦幻 2024-11-22 20:31:40

在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文