Cihan Okyay's Blog

Yet another open source developer

virtualenv ile psycopg2 kurmak

Eğer python ile geliştirme yaparken virtualenv kullanıyorsanız ve psycopg2 kurmaya kalkarsanız bir hata ile karşılaşıyorsunuz. (Kullandığım işletim sistemi Ubuntu 11.04)

1
(hellodjango)cihann@ferrari pip install -r requirements.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Downloading/unpacking Django==1.3 (from -r requirements.txt (line 1))
Running setup.py egg_info for package Django
 
Downloading/unpacking psycopg2==2.4.2 (from -r requirements.txt (line 2))
Running setup.py egg_info for package psycopg2
 
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'.
Complete output from command python setup.py egg_info:
running 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
 
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'.
 
----------------------------------------

Bu aşamada kaldıysanız eğer ubuntu ‘da kurmanız gereken iki paket var. libpq-dev ve python-dev.

1
sudo apt-get install libpq-dev python-dev

Ardından tekrar pip ile kurmayı deniyoruz psycopg2 paketini.

1
(hellodjango)cihann@ferrari pip install -r requirements.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Downloading/unpacking Django==1.3 (from -r requirements.txt (line 1))
Running setup.py egg_info for package Django
 
Downloading/unpacking psycopg2==2.4.2 (from -r requirements.txt (line 2))
Running setup.py egg_info for package psycopg2
 
no previously-included directories found matching 'doc/src/_build'
Installing collected packages: Django, psycopg2
Running setup.py install for Django
changing mode of build/scripts-2.7/django-admin.py from 644 to 755
 
changing mode of /home/cihann/hellodjango/bin/django-admin.py to 755
Running setup.py install for psycopg2
building 'psycopg2._psycopg' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x080408 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
 
.....
 
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o build/temp.linux-x86_64-2.7/psycopg/green.o build/temp.linux-x86_64-2.7/psycopg/pqpath.o build/temp.linux-x86_64-2.7/psycopg/utils.o build/temp.linux-x86_64-2.7/psycopg/bytes_format.o build/temp.linux-x86_64-2.7/psycopg/connection_int.o build/temp.linux-x86_64-2.7/psycopg/connection_type.o build/temp.linux-x86_64-2.7/psycopg/cursor_int.o build/temp.linux-x86_64-2.7/psycopg/cursor_type.o build/temp.linux-x86_64-2.7/psycopg/lobject_int.o build/temp.linux-x86_64-2.7/psycopg/lobject_type.o build/temp.linux-x86_64-2.7/psycopg/notify_type.o build/temp.linux-x86_64-2.7/psycopg/xid_type.o build/temp.linux-x86_64-2.7/psycopg/adapter_asis.o build/temp.linux-x86_64-2.7/psycopg/adapter_binary.o build/temp.linux-x86_64-2.7/psycopg/adapter_datetime.o build/temp.linux-x86_64-2.7/psycopg/adapter_list.o build/temp.linux-x86_64-2.7/psycopg/adapter_pboolean.o build/temp.linux-x86_64-2.7/psycopg/adapter_pdecimal.o build/temp.linux-x86_64-2.7/psycopg/adapter_pint.o build/temp.linux-x86_64-2.7/psycopg/adapter_pfloat.o build/temp.linux-x86_64-2.7/psycopg/adapter_qstring.o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o build/temp.linux-x86_64-2.7/psycopg/typecast.o -lpq -o build/lib.linux-x86_64-2.7/psycopg2/_psycopg.so
 
no previously-included directories found matching 'doc/src/_build'
Successfully installed Django psycopg2
Cleaning up...

Gördüğünüz gibi kurulum tamamlandı.

1
(hellodjango)cihann@ferrari pip freeze
1
2
3
Django==1.3
psycopg2==2.4.2
wsgiref==0.1.2

Comments