简体   繁体   English

使用OSX Mavericks和Psycopg2的PostgreSQL无法与Mac上的Django Localhost连接

[英]PostgreSQL with OSX Mavericks and Psycopg2 not able to connect with Django Localhost on Mac

I am currently running: 我目前正在运行:

Postgresql 9.3.1
psycopg2==2.5.2
OSX Mavericks 10.9.2
Python 2.7.6
Django 1.5.4

I am trying to launch my Django App to test, but am getting a configuration error with psycopg2. 我正在尝试启动我的Django App进行测试,但是我遇到了psycopg2的配置错误。 This is the error. 这是错误。 It was working before upgrading the OSX to Mavericks, and now I can't get it to work. 它在将OSX升级到Mavericks之前一直在工作,现在我无法让它工作。 Any ideas on how to fix this? 有想法该怎么解决这个吗?

ImportError: dlopen(/Users/Yuki_Aaron/Documents/virtualenvs/flapsta2/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libpq.5.dylib
  Referenced from: /Users/Yuki_Aaron/Documents/virtualenvs/flapsta2/lib/python2.7/site-packages/psycopg2/_psycopg.so
  Reason: no suitable image found.  Did find:
    /usr/local/lib/libpq.5.dylib: mach-o, but wrong architecture
    /usr/lib/libpq.5.dylib: mach-o, but wrong architecture

To get this working I had to symlink the most recent libpq.5.dylib file from my PostgreSQL directory to my /usr/lib/libqp.5.dylib file, and PostgreSQL and Psycopg2 finally work! 为了实现这一点,我必须将最新的 libpq.5.dylib文件从我的PostgreSQL目录符号链接到我的/usr/lib/libqp.5.dylib文件, PostgreSQLPsycopg2最终工作!

@serakiel , thank you for your suggestion, that helped lead to the answer. @serakiel ,谢谢你的建议,这有助于找到答案。

Here is the command that I ran in Terminal to fix the issue: 这是我在终端中运行以解决问题的命令:

sudo ln -fs /library/postgresql/9.3/lib/libpq.5.6.dylib /usr/lib/libpq.5.dylib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM