2010-02-23 114 views
6

在蟒蛇的Win32擴展安裝Python我需要保持大量的Windows XP機器上運行的Python的版本相同,與模塊的分類,其中之一是蟒蛇-win32的。我想過在所有客戶端機器安裝的網絡驅動器上安裝python,並調整客戶端的路徑。 Python從網絡開始了罰款,但在導入時win32com我得到一個彈出錯誤說:與網絡驅動器

The procedure entry point [email protected]@[email protected]@[email protected] could not be located in the dynamic link library pywintypes24.dll

駁回消息對話框後,我在控制檯中看到:

ImportError: DLL load failed: The specified procedure could not be found.

我搜索了蟒蛇目錄爲pywintypes24.dll,它存在於「Lib \ site-packages \ pywin32_system32」中。

我缺少什麼,並在那裏我可以一次安裝Python +的Python的Win32 +附加模塊,並讓它們在很多機器上運行的另一個方法是什麼?我無法訪問微軟的系統管理工具,所以我需要比這更低技術。

回答

7

在每臺機器上,你必須基本上運行一次後面的pywin32_postinstall.py -install。假設在網絡上你的Python安裝N:\Python26,運行下面的每個客戶端上的命令:

N:\Python26\python.exe N:\Python26\Scripts\pywin32_postinstall.py -install 

另一個重要的事情是Good Luck!。原因是你可能需要這樣做admin。在我的情況下,這種設置只適用於一臺電腦。我仍然沒有弄清楚爲什麼。

0

「」「我搜索的pywintypes24.dll蟒蛇目錄,它出現在‘庫\站點包\ pywin32_system32’‘’」。該DLL的存在沒有問題。那個入口在那個dll中?

您是否嘗試過在非網絡驅動器上安裝完全相同的配置?

您是否試過在包中導入其他模塊?

你檢查過的DLL與依賴學步車或類似的東西?

pywintypes24.dll中的「24」是否意味着Python 2.4?你運行的是什麼版本的Python?

+0

是,該DLL包含引用切入點,它具有相同的md5sum上的DLL我本地C:安裝,加載win32com模塊沒有問題。 – florin 2010-02-23 17:13:32

0

你可以使用batch files running at boot

  • 安裝網絡共享(net use \\server\share
  • 複製從網絡共享的Python和包安裝到本地文件夾
  • 對MSI安裝程序的檢查版本安裝版本
  • 如果不同,卸載Python和所有版本依賴包
  • 重新安裝所有包

這將是該軟件幾乎滾你自己的中央管理系統。

1

Python(或確切地說,操作系統)使用os.environ [「PATH」]而不是通過搜索sys.path來搜索DLL。

所以,你可以使用一個簡單的.cmd文件來啓動Python,而不是將\ server \ share \ python26添加到路徑中(假設安裝程序(或你)從\ server \ share \ python26 \ lib \ site- packages \ pywin32-system32到\ server \ share \ python26)。

或者,您可以將下面的代碼添加到您的腳本,它們試圖導入WIN32API等前:

# Add Python installation directory to the path, 
    # because on Windows 7 the pywin32 installer fails to copy 
    # the required DLLs to the %WINDIR%\System32 directory and 
    # copies them to the Python installation directory instead. 
    # Fortunately, in Python it is possible to modify the PATH 
    # before loading the DLLs. 
    os.environ["PATH"] = sys.prefix + ";" + os.environ.get("PATH") 
    import win32gui 
    import win32con