2015-10-19 81 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