使用PIP在OSX(yosemite)上安装psycopg时出错

时间:2015-07-07 19:52:14

标签: python macos postgresql psycopg2

我在尝试在OSX上安装postgresql时遇到了一个我不完全理解的奇怪链接器错误。

我已经通过Brew安装了Postgres,现在我正试图启动并运行我的Django应用程序。我已将postgres目录添加到我的路径中。我正在运行OSX Yosemite。

当我运行以下命令时:

pip install psycopg2

我收到此错误:

ld: illegal text reloc in '_init_psycopg' to '_lobjectType' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1

我不知道从哪里开始,我搜索这类错误导致我无处可去。任何帮助都会很棒。

感谢。

1 个答案:

答案 0 :(得分:0)

原来我安装了几个版本的Postgres。我不得不删除旧的,并确保在PATH中找到的pg_config是最新的。一旦我确定pg_config是正确的,这个错误就消失了。