在网络驱动器上安装带有 python win32 扩展的 python
我需要保持大量 Windows XP 计算机运行相同版本的 python,并带有各种模块,其中之一是 python-win32。我考虑过在所有客户端机器都安装的网络驱动器上安装python,然后只调整客户端上的路径。 Python 从网络启动正常,但是当导入 win32com 时,我收到一个弹出错误消息:
无法在动态链接库pywintypes24.dll中定位程序入口点?PyWinObject_AsHANDLE@@YAHPAU_object@@PAPAXH@Z
关闭我在控制台中收到的消息对话框后,
导入错误:DLL 加载失败:找不到指定的过程。
我在 python 目录中搜索了 pywintypes24.dll,它位于 "Lib\site-packages\pywin32_system32" 中。
我缺少什么?是否有另一种方法可以安装 Python + Python-Win32 + 附加模块一次并让它们在许多机器上运行?我无法使用 Microsoft 系统管理工具,因此我需要技术含量较低的产品。
I need to keep a large number of Windows XP machines running the same version of python, with an assortment of modules, one of which is python-win32. I thought about installing python on a network drive that is mounted by all the client machines, and just adjust the path on the clients. Python starts up fine from the network, but when importing win32com I get a pop-up error saying:
The procedure entry point ?PyWinObject_AsHANDLE@@YAHPAU_object@@PAPAXH@Z could not be located in the dynamic link library pywintypes24.dll
after dismissing the message dialog I get in the console:
ImportError: DLL load failed: The specified procedure could not be found.
I searched the python directory for the pywintypes24.dll and it is present in "Lib\site-packages\pywin32_system32" .
What am I missing and is there another way in which I can install Python + Python-Win32 + additional module once and have them running on many machines? I don't have access to the Microsoft systems management tools, so I need to be a bit more low-tech than that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在每台机器上,您基本上都必须运行一次
pywin32_postinstall.py -install
。假设您在网络上的 Python 安装是N:\Python26
,请在每个客户端上运行以下命令:另一件重要的事情是
Good Luck!
。原因是您可能需要以admin
身份执行此操作。就我而言,这种设置适用于除一台计算机之外的所有计算机。我还是不明白为什么。On every machine you have to basically run following
pywin32_postinstall.py -install
once. Assuming your python installation on the network isN:\Python26
, run following command on every client:Another important thing is
Good Luck!
. The reason is that you might need to do this asadmin
. In my case such setup worked for all but one computer. I still did not figure out why.Python(或者准确地说,操作系统)使用 os.environ["PATH"] 搜索 DLL,而不是通过搜索 sys.path。
因此,您可以使用简单的 .cmd 文件启动 Python,该文件将 \server\share\python26 添加到路径(假设安装程序(或您)从 \server\share\python26\lib\site-packages\pywin32 复制了 DLL) system32 到 \server\share\python26)。
或者,您可以在脚本尝试导入 win32api 等之前将以下代码添加到脚本中:
Python (or precisely, the OS) searches the DLLs using os.environ["PATH"] and not by searching sys.path.
So you could start Python using a simple .cmd file instead which adds \server\share\python26 to the path (given the installer (or you) copied the DLLs from \server\share\python26\lib\site-packages\pywin32-system32 to \server\share\python26).
Or, you can add the following code to your scripts before they try to import win32api etc:
您可以使用启动时运行的批处理文件来
net use \\server\share
)这几乎是您自己的该软件的中央管理系统。
You could use batch files running at boot to
net use \\server\share
)This would be pretty much a roll your own central management system for that software.