我尝试了这个技巧http://jazstudios.blogspot.com/2010/07/installing-mysql-python-mysqldb-in.html来在虚拟环境(名为dogme)中安装mysql-python(mysqldb)。
(此帖指出两个重要的事情:
有人能理解出了什么问题吗?
export ARCHFLAGS="-arch x86_64"
echo "mysql_config = /opt/local/bin/mysql_config5" >> ./dogme/build/MySQL-python/site.cfg
帮助编译mysqldb:
但是,当我运行Python并导入MySQLdb时,出现以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/.virtualenvs/dogme/lib/python2.5/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/home/.virtualenvs/dogme/lib/python2.5/site-packages/_mysql.so, 2): Symbol not found: _mysql_affected_rows
Referenced from: /home/.virtualenvs/dogme/lib/python2.5/site-packages/_mysql.so
Expected in: flat namespace
in /home/.virtualenvs/dogme/lib/python2.5/site-packages/_mysql.so
有人能理解出了什么问题吗?