2015-02-11 170 views
1

我想構建一個測試Django應用程序,並且我想連接到MSSQL服務器。當我嘗試運行我的程序時,出現錯誤ImportError: No module named pythoncom。所以我想這是一個缺失的模塊,所以我下載python32(32位)for python 2.7並安裝(成功)。問題是,錯誤仍然出現,我似乎無法擺脫它。我從運行安裝作爲管理員ActivePtyhon想盡一切(凍結在確定磁盤空間..)「no module named pythoncom」

這是原來的異常消息:

self.ensure_connection() 
    File "C:\Users\pce-coop\Desktop\Test Power Monitoring App\Test Django App\Blan 
kProject\BlankProject\env\lib\site-packages\django\db\backends\__init__.py", lin 
e 133, in ensure_connection 
    self.connect() 
    File "C:\Users\pce-coop\Desktop\Test Power Monitoring App\Test Django App\Blan 
kProject\BlankProject\env\lib\site-packages\django\db\backends\__init__.py", lin 
e 122, in connect 
    self.connection = self.get_new_connection(conn_params) 
    File "C:\Users\pce-coop\Desktop\Test Power Monitoring App\Test Django App\Blan 
kProject\BlankProject\env\lib\site-packages\sqlserver_ado\base.py", line 244, in 
get_new_connection 
    conn = Database.connect(**conn_params) 
    File "C:\Users\pce-coop\Desktop\Test Power Monitoring App\Test Django App\Blan 
kProject\BlankProject\env\lib\site-packages\sqlserver_ado\dbapi.py", line 171, i 
n connect 
    import pythoncom 
ImportError: No module named pythoncom 
+0

的重複HTTP:/ /stackoverflow.com/questions/4145079/importerror-no-module-named-pythoncom – sax 2015-02-11 19:44:34

+0

我已經看過帖子,並嘗試一切它建議,它仍然無法正常工作...因此,爲什麼我發佈的問題 – john 2015-02-11 20:29:02

回答

0

的easy_install使用我的虛擬環境,而不是進入的該命令,我使用了pywin32.exe的路徑名。就我而言,這是 「C:\用戶\ PC \下載\ pywin32-219.win32-py2.7.exe」

0

pythoncom也包含在pypiwin32包:

> pip install pypiwin32