2015-10-19 389 views
0

我在服务器上安装了PostgreSQL的办公室工作。 在我的Windows机器上,我安装了pgAdmin III 1.20来访问数据库。 我想在我的Windows系统中安装psycopg2。我得到这个错误:无法在Windows上安装psycopg2

C:\users\Tony> pip install psycopg2 
Collecting psycopg2 
Using cached psycopg2-2.6.1.tar.gz 
Complete output from command python setup.py egg_info: 
running egg_info 
creating pip-egg-info\psycopg2.egg-info 
writing pip-egg-info\psycopg2.egg-info\PKG-INFO 
writing top-level names to pip-egg-info\psycopg2.egg-info\top_level.txt 
writing dependency_links to pip-egg-info\psycopg2.egg-info\dependency_links.txt 
writing manifest file 'pip-egg-info\psycopg2.egg-info\SOURCES.txt' 
warning: manifest_maker: standard file '-c' not found 

Error: pg_config executable not found. 

Please add the directory containing pg_config to the PATH 
or specify the full executable path with the option: 

    python setup.py build_ext --pg-config /path/to/pg_config build ... 

or with the pg_config option in 'setup.cfg'. 

---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in c:\users\Tony\appdata\local\temp\pip-build-dobxew\psycopg2 

我知道pg_config在PostgreSQL的bin文件夹中可用。但是我无法访问服务器中的那个位置。没有pg_config文件,我无法在我的本地windows机器上安装psycopg2。 (p:\ Program Files(x86)\ pgAdmin III \ 1.20) 如何使用pgAdmin III 1.20将libpq.dll的路径添加到我的系统路径中然后使用Python访问PostgreSQL数据库?

+0

是否安装了postgres? –

+0

@JavierBuzzi是的postgres安装在我使用pgAdmin客户端访问的服务器上。 – Tony

回答

0

使用this page可下载Windows的预建二进制文件。

+0

这对我有用。 @mpcabd – Tony

0

下载psycopg2版本的Python和窗口从这里win-psycopg

不要双击该包运行。相反,请使用setuptoolsdistribute的easy_install。

C:\> easy_install psycopg2-2.6.1.win32-py2.7-pg9.4.4-release.exe