2015-12-09 41 views
0

我想連接我的django 1.9項目到postgresql數據庫。首先我需要安裝psycopg2。我從http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg得到我的psycopg文件。不過,我無法安裝,我有一個「無法找到vcvarsall.bat」錯誤。psycopg2安裝錯誤:無法找到vcvarsall.bat

我的python版本是3.5.1。

這是我的錯誤;

copying tests\test_quote.py -> build\lib.win-amd64-3.5\psycopg2\tests 
copying tests\test_transaction.py -> build\lib.win-amd64-3.5\psycopg2\tests 
copying tests\test_types_basic.py -> build\lib.win-amd64-3.5\psycopg2\tests 
copying tests\test_types_extras.py -> build\lib.win-amd64-3.5\psycopg2\tests 

copying tests\test_with.py -> build\lib.win-amd64-3.5\psycopg2\tests 
copying tests\__init__.py -> build\lib.win-amd64-3.5\psycopg2\tests 
Skipping optional fixer: buffer 
Skipping optional fixer: idioms 
Skipping optional fixer: set_literal 
Skipping optional fixer: ws_comma 
running build_ext 
building 'psycopg2._psycopg' extension 
error: Unable to find vcvarsall.bat 

---------------------------------------- 
Command "c:\python\python35\python.exe -c "import setuptools, tokenize;__file__= 
'C:\\Users\\User\\AppData\\Local\\Temp\\pip-build-4q_3mvan\\psycopg2\\setup.py'; 
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\ 
n'), __file__, 'exec'))" install --record C:\Users\User\AppData\Local\Temp\pip-e 
kz8kaam-record\install-record.txt --single-version-externally-managed --compile" 
failed with error code 1 in C:\Users\User\AppData\Local\Temp\pip-build-4q_3mvan 
\psycopg2 

有沒有人有想法?謝謝..

+1

使用下載的wheel文件安裝psycopg2的命令是'c:\ python \ python35 \ python.exe -m pip install psycopg2-2.6.1-cp35-none-win_amd64.whl' – cgohlke

+0

這就是答案。非常感謝你.. – kbrk

回答

1

psycopg2需要編譯各種開發庫。在Windows上,這通常是通過使用Visual Studio的一些版本來實現的 - 這是vcvarsall.bat文件的全部內容 - 通常是一個巨大的痛苦。幸運的是,傑森埃裏克森維護一個Windows端口psycopg2 here.

我現在看到您正在使用Python 3.5,似乎並沒有該版本可用的版本。幸運的是,有一個答案already on Stack Overflow.(其中一條評論說,在鏈接頁面上沒有Python 3.5的版本,但事實並非如此)

+0

謝謝詹姆斯。是的,我知道這個職位。它已於二月發佈。似乎仍然沒有python 3.5支持psycopg2。 – kbrk

相關問題