无法在 Mac OS X 10.7 上的 virtualenv 中使用 pip 安装 psycopg2 [英] Can't install psycopg2 with pip in virtualenv on Mac OS X 10.7

查看:35
本文介绍了无法在 Mac OS X 10.7 上的 virtualenv 中使用 pip 安装 psycopg2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照 Heroku 的教程部署 Django 应用程序:http://devcenter.heroku.com/articles/django#先决条件.

I am following Heroku's tutorial to deploy a Django app: http://devcenter.heroku.com/articles/django#prerequisites.

一切正常,直到我到达这部分:

Everything is working fine until I get to this part:

$ pip install Django psycopg2

我可以自己安装 Django,但问题是使用 psycopg2.

I can install Django by itself, but the probelm is with psycopg2.

我不断收到此错误:

ld: library not found for -lpq

collect2: ld returned 1 exit status

ld: library not found for -lpq

collect2: ld returned 1 exit status

lipo: can't open input file: /var/folders/_4/p6l0y0t51hd4xbq7llbyshmw0000gn/T//cc0L10mI.out (No such file or directory)

error: command 'gcc-4.2' failed with exit status 1

我已经在我的机器上安装了 PostgreSQL 9.1.

I've installed PostgreSQL 9.1 on my machine.

另外,在输出中,有一堆这样的行:

Also, in the output, there are bunch of lines like this:

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.4 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090004 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/typecast.c -o build/temp.macosx-10.6-intel-2.7/psycopg/typecast.o

我不太确定这是什么意思,但我确实注意到其中包含macosx-10.6",所以我想知道这是否可能是问题所在?我在 10.7.

I'm not really sure what it means, but I do notice that it has "macosx-10.6" in it so I'm wondering if that could be the issue? I'm on 10.7.

预先感谢您的帮助.

推荐答案

参考官方安装指南心理测试:

在 Mac OS X 上安装 作为第一选择,请考虑使用来自 Fink 或 MacPorts 的 Psycopg 打包版本.

Installing on Mac OS X As a first option, please consider using a packaged version of Psycopg from Fink or MacPorts.

如果您仍然想从源代码构建 Psycopg,请查看 这些文章.

If you still want to build Psycopg from source, take a look at these articles.

这篇关于无法在 Mac OS X 10.7 上的 virtualenv 中使用 pip 安装 psycopg2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆