python - Django: Error loading psycopg2 -
python - Django: Error loading psycopg2 -
i next geodjango tutorial (https://docs.djangoproject.com/en/1.8/ref/contrib/gis/tutorial/#geographic-models) , got migrate step, , getting error "cannot import name util". i'm not sure problem is. also, engine set 'django.contrib.gis.db.backends.postgis' in settings.py file. know how prepare this? thanks!
$ python manage.py makemigrations ... __import__(name) file "//anaconda/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 3, in <module> django.db.backends.postgresql_psycopg2.base import \ file "//anaconda/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 20, in <module> raise improperlyconfigured("error loading psycopg2 module: %s" % e) django.core.exceptions.improperlyconfigured: error loading psycopg2 module: cannot import name util
i figured out how solve it. provide details in case else has problem , reads post: ended downloading source bundle http://initd.org/psycopg/download/. then, followed instructions under "use source package" @ page: http://initd.org/psycopg/docs/install.html. before entering commands in terminal, went psycopg2-2.6 folder in downloads , manually edited path in setup.cfg file. have uncomment line "pg_config=" , come in path pg_config, can found using finder on mac. (as example, path pg_config on computer /opt/local/lib/postgresql93/bin/pg_config) next list of commands used in terminal:
$ cd downloads $ cd psycopg2-2.6 $ python setup.py build $ sudo python setup.py install
python django
Comments
Post a Comment