在Mac上使用Python2.6安装psycopg2
我刚开始学习Python,现在在用Python2.6。我正在按照Python网站上的教程进行学习。我的问题是,当我试着按照这里的说明操作时:
http://py-psycopg.darwinports.com/
我遇到了类似这样的情况...
sudo port install py-psycopg
... bunch of errors here...
Error: The following dependencies failed to build: py-mx python24
我在使用MacOS X 10.4。
我该怎么才能让它正常工作呢?
任何回复我都会非常感激。
更新:
在运行下面的代码后,我得到了以下错误:
$ sudo port install py26-psycopg2
Warning: Skipping upgrade since openssl 0.9.8k_0 >= openssl 0.9.8k_0, even though installed variants "" do not match "+darwin". Use 'upgrade --enforce-variants' to switch to the requested variants.
Warning: Skipping upgrade since readline 6.0.000_1 >= readline 6.0.000_1, even though installed variants "" do not match "+darwin". Use 'upgrade --enforce-variants' to switch to the requested variants.
---> Computing dependencies for py26-psycopg2
---> Building python26
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.2" && /usr/bin/make all MAKE="/usr/bin/make CC=/usr/bin/gcc-4.0" " returned error 2
Command output: /usr/bin/install -c -d -m 755 Python.framework/Versions/2.6
if test ""; then \
/usr/bin/gcc-4.0 -o Python.framework/Versions/2.6/Python -dynamiclib \
-isysroot "" \
-all_load libpython2.6.a -Wl,-single_module \
-install_name /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python \
-compatibility_version 2.6 \
-current_version 2.6; \
else \
/usr/bin/libtool -o Python.framework/Versions/2.6/Python -dynamic libpython2.6.a \
-lSystem -lSystemStubs -install_name /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python -compatibility_version 2.6 -current_version 2.6 ;\
fi
ld64 failed: in libpython2.6.a(__.SYMDEF), not a valid ppc64 mach-o file
/usr/bin/libtool: internal link edit command failed
make: *** [Python.framework/Versions/2.6/Python] Error 1
Error: The following dependencies failed to build: python26
Error: Status 1 encountered during processing.
顺便说一下,我安装的Python是从Python网站下载的dmg文件。
谢谢,
Wenbert
5 个回答
1
我在10.4的Mac上安装psycopg2
时也遇到了问题。我是通过dmg文件安装的Python和Postgres,而用sudo easy_install psycopg2
命令时出现了一个我现在记不起来的错误。对我来说,有一个简单的解决办法:
PATH=$PATH:/Library/PostgreSQL/8.3/bin/ sudo easy_install psycopg2
这个方法我是在http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/上找到的。
3
也许你需要看看这个适用于Python 2.6的版本?
10
如果你在用Python 2.6的话,其实你需要安装的是 py26-psycopg2
。
$ sudo port install py26-psycopg2
在MacPorts中,py-*
这些包是用Python 2.4构建的,py25-*
是用Python 2.5构建的,而 py26-*
则是用Python 2.6构建的。