无法在Windows 7上使用Python 3.4.3和PostgreSQL 9.4.4安装psycopg

时间:2015-08-21 18:15:27

标签: python windows postgresql

我使用Python 3.4.3和PostgreSQL 9.4.4在Windows 7(64位)上安装psycopg,使用轮文件(来自http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg)和命令:

pip install psycopg2-2.6.1-cp34-none-win_amd64.whl

我收到错误:

psycopg2-2.6.1-cp34-none-win_amd64.whl is not a supported wheel on this platform.

更新: 我尝试使用easy_install命令:

easy_install psycopg2-2.6.1.win-amd64-py3.4-pg9.4.4-release.exe

Searching for psycopg2-2.6.1.win-amd64-py3.4-pg9.4.4-release.exe
Reading https://pypi.python.org/simple/psycopg2-2.6.1.win-amd64-py3.4-pg9.4.4-re
lease.exe/
Couldn't find index page for 'psycopg2-2.6.1.win-amd64-py3.4-pg9.4.4-release.exe
' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for psycopg2-2.6.1.win-amd64-py3.4-pg9
.4.4-release.exe
error: Could not find suitable distribution for Requirement.parse('psycopg2-2.6.
1.win-amd64-py3.4-pg9.4.4-release.exe')

2 个答案:

答案 0 :(得分:2)

您需要安装psycopg2‑2.6.1‑cp34‑none‑win32.whl。您的Windows可能是64位,但您的Python安装仍然是32位。您安装的软件包应该与您的Python安装相匹配,而不是Windows安装。

这是一个常见问题,因为http://python.org默认情况下会将您重定向到Python 32位,即使在使用Windows 64位甚至Chrome 64位浏览时也是如此。

答案 1 :(得分:1)

试试这个:

C:\>python -m easy_install --upgrade setuptools
C:\>cd path\to\folder\psycopg
D:\path\>python -m pip install psycopg2-2.6.1-cp34-none-win_amd64.whl