我刚刚将其安装在系统上,这些是我为使其正常运行而执行的步骤:
I've just installed this on my system and these are the steps I did to make it working:
- 下载Mysql-python: http://sourceforge.net/projects/mysql -python/files/mysql-python/1.2.2/(我使用的是1.2.2版本)
- 解压缩,去那里并通过删除37-19行(ifdefine)来编辑_mysql.c文件
- 在site.cfg中设置mysql_config =/usr/local/mysql/bin/mysql_config
- sudo python setup.py构建(我运行了两次,而第一个运行时却吐出了一些奇怪的东西,第二次却没有出现错误……我读到了这,这是很奇怪的东西)
- sudo python setup.py安装
- sudo ln -s/usr/local/mysql/lib/libmysqlclient.18.dylib/usr/lib/libmysqlclient.18.dylib
- sudo ln -s/usr/local/mysql/lib//usr/local/mysql/lib/mysql
- Download Mysql-python: http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/ (I've used 1.2.2 version)
- Extract, go there and edit _mysql.c file by removing 37-19 lines (ifdefine)
- In site.cfg set mysql_config = /usr/local/mysql/bin/mysql_config
- sudo python setup.py build (this one I ran two times, while the first one spitted something weird, second time went without errors... I read about this and this is weird stuff)
- sudo python setup.py install
- sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
- sudo ln -s /usr/local/mysql/lib/ /usr/local/mysql/lib/mysql
最后,您只需尝试在python中导入MySQLdb.希望对您也有用.
And finally you just try import MySQLdb in python. Hope that worked also for you.
伊格纳斯