无法在mac OS X 10.8.4上安装pscyopg2

时间:2013-08-14 21:06:02

标签: python macos heroku psycopg2

我试图将SQLAlchemy数据库连接到Postgres,以便我可以将我的Flask Web应用程序通过heroku推送到互联网上。但是,当我跑

pip install psycopg2

我的退出状态为1.它输出了大量的垃圾。任何人都可以帮助我,我不知道该怎么办!在垃圾输出的开头,它表示库函数的重新声明不兼容' fmaxf''。那到底是什么意思?!然后在终端上有大量的垃圾输出,以这一切结束:

ld: library not found for -lpq

clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------
Command /Users/austin/Documents/Coding/Python/venv/paige_website/bin/python3 -c "import setuptools;__file__='/Users/austin/Documents/Coding/Python/venv/paige_website/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/1q/k1q3jkdm8xjgz90059b_rgdh0000gn/T/pip-w61fiv-record/install-record.txt --single-version-externally-managed --install-headers /Users/austin/Documents/Coding/Python/venv/paige_website/bin/../include/site/python3.3 failed with error code 1 in /Users/austin/Documents/Coding/Python/venv/paige_website/build/psycopg2
Storing complete log in /Users/austin/.pip/pip.log

有人请帮忙!提前谢谢!

pg_config output: 
BINDIR = /usr/bin
DOCDIR = /usr/share/doc/postgresql
HTMLDIR = /usr/share/postgresql
INCLUDEDIR = /usr/include
PKGINCLUDEDIR = /usr/include/postgresql
INCLUDEDIR-SERVER = /usr/include/postgresql/server
LIBDIR = /usr/lib
PKGLIBDIR = /usr/lib/postgresql
LOCALEDIR = /usr/share/locale
MANDIR = /usr/share/man
SHAREDIR = /usr/share/postgresql
SYSCONFDIR = /private/etc/postgresql
PGXS = /usr/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--infodir=/usr/share/info' '--disable-dependency-tracking' '--prefix=/usr' '--sbindir=/usr/libexec' '--sysconfdir=/private/etc' '--mandir=/usr/share/man' '--localstatedir=/private/var/pgsql' '--htmldir=/usr/share/postgresql' '--enable-thread-safety' '--enable-dtrace' '--with-tcl' '--with-perl' '--with-python' '--with-gssapi' '--with-krb5' '--with-pam' '--with-ldap' '--with-bonjour' '--with-openssl' '--with-libxml' '--with-libxslt' '--with-system-tzdata=/usr/share/zoneinfo' 'CC=/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc' 'CFLAGS=-arch x86_64 -pipe -Os -g -Wall -Wno-deprecated-declarations' 'LDFLAGS=-arch x86_64 -pipe -Os -g -Wall -Wno-deprecated-declarations' 'LDFLAGS_EX=-mdynamic-no-pic'
CC = /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
CPPFLAGS = -I/usr/include/libxml2
CFLAGS = -arch x86_64 -pipe -Os -g -Wall -Wno-deprecated-declarations -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv
CFLAGS_SL = 
LDFLAGS = -arch x86_64 -pipe -Os -g -Wall -Wno-deprecated-declarations -Wl,-dead_strip_dylibs
LDFLAGS_EX = -mdynamic-no-pic
LDFLAGS_SL = 
LIBS = -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm 
VERSION = PostgreSQL 9.1.5

链接器输出结束:

/usr/include/math.h:543:15: note: 'fmin' is a builtin with type 'double (double)'
/usr/include/math.h:544:20: warning: incompatible redeclaration of library function 'fminl'
extern long double fminl(long double, long double);
                   ^
/usr/include/math.h:544:20: note: 'fminl' is a builtin with type 'long double (long double)'
6 warnings generated.
In file included from psycopg/typecast.c:27:
In file included from ./psycopg/psycopg.h:30:
In file included from /Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m/Python.h:50:
In file included from /Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m/pyport.h:340:
/usr/include/math.h:538:14: warning: incompatible redeclaration of library function 'fmaxf'
extern float fmaxf(float, float);
             ^
/usr/include/math.h:538:14: note: 'fmaxf' is a builtin with type 'float (float)'
/usr/include/math.h:539:15: warning: incompatible redeclaration of library function 'fmax'
extern double fmax(double, double);
              ^
/usr/include/math.h:539:15: note: 'fmax' is a builtin with type 'double (double)'
/usr/include/math.h:540:20: warning: incompatible redeclaration of library function 'fmaxl'
extern long double fmaxl(long double, long double);
                   ^
/usr/include/math.h:540:20: note: 'fmaxl' is a builtin with type 'long double (long double)'
/usr/include/math.h:542:14: warning: incompatible redeclaration of library function 'fminf'
extern float fminf(float, float);
             ^
/usr/include/math.h:542:14: note: 'fminf' is a builtin with type 'float (float)'
/usr/include/math.h:543:15: warning: incompatible redeclaration of library function 'fmin'
extern double fmin(double, double);
              ^
/usr/include/math.h:543:15: note: 'fmin' is a builtin with type 'double (double)'
/usr/include/math.h:544:20: warning: incompatible redeclaration of library function 'fminl'
extern long double fminl(long double, long double);
                   ^
/usr/include/math.h:544:20: note: 'fminl' is a builtin with type 'long double (long double)'
6 warnings generated.
/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -g build/temp.macosx-10.6-intel-3.3/psycopg/psycopgmodule.o build/temp.macosx-10.6-intel-3.3/psycopg/green.o build/temp.macosx-10.6-intel-3.3/psycopg/pqpath.o build/temp.macosx-10.6-intel-3.3/psycopg/utils.o build/temp.macosx-10.6-intel-3.3/psycopg/bytes_format.o build/temp.macosx-10.6-intel-3.3/psycopg/connection_int.o build/temp.macosx-10.6-intel-3.3/psycopg/connection_type.o build/temp.macosx-10.6-intel-3.3/psycopg/cursor_int.o build/temp.macosx-10.6-intel-3.3/psycopg/cursor_type.o build/temp.macosx-10.6-intel-3.3/psycopg/diagnostics_type.o build/temp.macosx-10.6-intel-3.3/psycopg/error_type.o build/temp.macosx-10.6-intel-3.3/psycopg/lobject_int.o build/temp.macosx-10.6-intel-3.3/psycopg/lobject_type.o build/temp.macosx-10.6-intel-3.3/psycopg/notify_type.o build/temp.macosx-10.6-intel-3.3/psycopg/xid_type.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_asis.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_binary.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_datetime.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_list.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_pboolean.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_pdecimal.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_pint.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_pfloat.o build/temp.macosx-10.6-intel-3.3/psycopg/adapter_qstring.o build/temp.macosx-10.6-intel-3.3/psycopg/microprotocols.o build/temp.macosx-10.6-intel-3.3/psycopg/microprotocols_proto.o build/temp.macosx-10.6-intel-3.3/psycopg/typecast.o -L/usr/lib -lpq -lssl -lcrypto -o build/lib.macosx-10.6-intel-3.3/psycopg2/_psycopg.so
ld: library not found for -lpq
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题并按照这里的步骤重新开始工作: http://blog.timc3.com/2010/08/20/psycopg2-os-x-_pqbackendpid/

可能不需要吹掉我的整个postgresql安装,但无论如何都需要从9.1升级。看起来setup.cfg发生了变化,特别是配置中的static_libpq = 0设置,使这个安装成功。