読者です 読者をやめる 読者になる 読者になる

django PostgreSQL Error : Symbol not found: _lo_lseek64

Django 1.8
PostgreSQL 9.4
Mac OS X Yosemite (Version 10.10.5)

python manage.py runserver

でエラー。

    return import_module('%s.base' % backend_name)
  File "/Users/uuuuuuuu/.pyenv/versions/2.7.9/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/uuuuuuuu/.pyenv/versions/mmr2/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 24, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/uuuuuuuu/.pyenv/versions/mmr2/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _lo_lseek64
  Referenced from: /Users/uuuuuuuu/.pyenv/versions/mmr2/lib/python2.7/site-packages/psycopg2/_psycopg.so
  Expected in: /usr/lib/libpq.5.dylib
 in /Users/uuuuuuuu/.pyenv/versions/mmr2/lib/python2.7/site-packages/psycopg2/_psycopg.so

http://stackoverflow.com/questions/8237842/django-core-exceptions-improperlyconfigured-error-loading-psycopg-module-no-mo

Pythonインタープリターでも同じエラー。

>>> import psycopg2

psycopg2 を読み込んだ時に、Symbol not found: _lo_lseek64

http://stackoverflow.com/questions/28515972/problems-using-psycopg2-on-mac-os-yosemite

$ sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.old  
$ sudo ln -s /Library/PostgreSQL/9.4/lib/libpq.5.dylib /usr/lib

で直った。