Cihan Okyay

Feed Rss

virtualenv ile psycopg2 kurmak

10.09.2011, pip, Python, Tips & Tricks, virtualenv, by .

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][~/hellodjango]> pip install -r requirements.txt
  2. Downloading/unpacking Django==1.3 (from -r requirements.txt (line 1))
  3. Running setup.py egg_info for package Django
  4.  
  5. Downloading/unpacking psycopg2==2.4.2 (from -r requirements.txt (line 2))
  6. Running setup.py egg_info for package psycopg2
  7.  
  8. Error: pg_config executable not found.
  9.  
  10. Please add the directory containing pg_config to the PATH
  11. or specify the full executable path with the option:
  12.  
  13. python setup.py build_ext –pg-config /path/to/pg_config build …
  14.  
  15. or with the pg_config option in ‘setup.cfg’.
  16. Complete output from command python setup.py egg_info:
  17. running egg_info
  18.  
  19. writing pip-egg-info/psycopg2.egg-info/PKG-INFO
  20.  
  21. writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
  22.  
  23. writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
  24.  
  25. warning: manifest_maker: standard file ‘-c’ not found
  26.  
  27. Error: pg_config executable not found.
  28.  
  29. Please add the directory containing pg_config to the PATH
  30.  
  31. or specify the full executable path with the option:
  32.  
  33. python setup.py build_ext –pg-config /path/to/pg_config build …
  34.  
  35. or with the pg_config option in ‘setup.cfg’.
  36.  
  37. —————————————-

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][~/hellodjango]> pip install -r requirements.txt
  2. Downloading/unpacking Django==1.3 (from -r requirements.txt (line 1))
  3. Running setup.py egg_info for package Django
  4.  
  5. Downloading/unpacking psycopg2==2.4.2 (from -r requirements.txt (line 2))
  6. Running setup.py egg_info for package psycopg2
  7.  
  8. no previously-included directories found matching ‘doc/src/_build’
  9. Installing collected packages: Django, psycopg2
  10. Running setup.py install for Django
  11. changing mode of build/scripts-2.7/django-admin.py from 644 to 755
  12.  
  13. changing mode of /home/cihann/hellodjango/bin/django-admin.py to 755
  14. Running setup.py install for psycopg2
  15. building ‘psycopg2._psycopg’ extension
  16. 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=0×080408 -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
  17.  
  18. …..
  19.  
  20. 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
  21.  
  22. no previously-included directories found matching ‘doc/src/_build’
  23. Successfully installed Django psycopg2
  24. Cleaning up…

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

  1. (hellodjango)[cihann]@[ferrari][~/hellodjango]> pip freeze
  2. Django==1.3
  3. psycopg2==2.4.2
  4. wsgiref==0.1.2

Mutlu kodlamalar :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>