在Windows上安装Psycopg [英] Psycopg installation on windows

查看:85
本文介绍了在Windows上安装Psycopg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows(Windows 7,64位)下安装psycopg2。我正在使用Python 2.7.2 来自Python(x,y)和PostgreSQL 9.2 .1。

I am trying to install psycopg2 under Windows (Windows 7, 64 bit). I am using Python 2.7.2 from Python(x,y) and PostgreSQL 9.2.1 .

我的第一次尝试是使用可从 http://www.stickpeople.com/projects/python/win-psycopg/ (psycopg2-2.4.5.win-amd64-py2.7-pg9.1.3 -release.exe)。然后我得到一条消息

My first try was using the windows port that is downloadable from http://www.stickpeople.com/projects/python/win-psycopg/ (psycopg2-2.4.5.win-amd64-py2.7-pg9.1.3-release.exe). I get a message then that

Python 2.7 required but was not found in the registry

在下一个对话框中,不允许我选择任何python安装。

In the next dialogue it does not allow me to choose any python installations. All other programs and installations find my python happily.

此操作失败,我尝试直接使用 http://pypi.python.org/pypi/psycopg2 ,但尝试之后:

This being failed, I tried to use the source package directly from http://pypi.python.org/pypi/psycopg2 but after trying:

python setup.py install

我现在停留在错误消息中:

I am now stuck with the error message:

error: Unable to find vcvarsall.bat

有人知道如何解决吗?

推荐答案

使用与psycopg2安装程序期望的版本不同的Python发行版,因此找不到Python安装位置。

You're using a different Python distribution to the one the psycopg2 installer expects, so it cannot find the Python install location.

您可以按照以下步骤从下载的二进制文件中手动安装psycopg2。 psycopg2下载页面上的说明,了解有关使用Zope进行安装的问题,内容为:

You can manually install psycopg2 from the binaries you downloaded by following the instructions on the psycopg2 download page for issues installing with Zope, which read:


已经注意到,psycopg2的安装程序不会在python的zope安装中找到
,请停止安装,而不是
安装psycopg2。解决方法是通过将扩展名
从* .exe重命名为* .zip并使用zip提取器(例如
WinZip / PkZip / 7z)来提取文件psycopg2并将其放置,以提取文件。在
liblibpython。我不使用Zope,因此我将无法
提供有关如何使用它的支持或说明。让我知道
是否不起作用。

It has been noted that the the installers for psycopg2 will not find the zope installation of python, stop the installation, and not installing psycopg2. A work around is to extract the files by renaming the extension from *.exe to *.zip and using a zip extractor (such as WinZip/PkZip/7z) to extract the psycopg2 folder and place it at \lib\python. I do not use Zope, so I will not be able to provide support or instructions on how to use it. Let me know if it does not work, though.

同样适用您正在使用的Python(x,y)发行版。使用 7-zip 解压缩psycopg2安装程序 .exe ,然后复制 psycopg2 文件夹和 psycopg2-2.5.2-py2.7.egg-info文件(因此 psycopg2将出现在点冻结中)进入您的Python lib\site-packages 目录。请参见安装Python模块

The same will apply to the Python(x,y) distribution that you are using. Unzip the psycopg2 installer .exe using 7-zip, then copy the psycopg2 folder and 'psycopg2-2.5.2-py2.7.egg-info' file (so 'psycopg2' will apear on 'pip freeze') into your Python lib\site-packages directory. See installing Python modules.

您应该然后能够导入psycopg2

这篇关于在Windows上安装Psycopg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆