我是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是pythong站点的dmg文件。
谢谢, Wenbert
答案 0 :(得分:10)
如果您使用的是Python 2.6,那么您实际上想要构建py26-psycopg2
:
$ sudo port install py26-psycopg2
在MacPorts中,py-*
包使用Python 2.4构建,py25-*
使用Python 2.5构建,py26-*
使用Python 2.6。
答案 1 :(得分:3)
也许您需要查看version for Python 2.6?
答案 2 :(得分: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 :(得分:0)
我使用setuptools和easy_install在我的Mac上安装了psycopg2。首先从setuptools downloads page获取Python 2.6 egg,然后按照该页面上的说明进行安装。然后,您可以运行以下命令来安装它:
sudo easy_install psycopg2
你可能有不同的运气,但这就是为我做的。
答案 4 :(得分:0)
我尝试了一切,没有任何作用。至少这篇文章: http://benkreeger.com/post/312303245/conquering-symbol-not-found-pqbackendpid
带我到自制软件,这使它完美无缺。