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

问题描述

我遵循Heroku的教程部署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,但是probelm是用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.

提前感谢您的帮助。

推荐答案

请参阅:

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

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

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

08-24 06:58