mac 安装 mysql-python 折腾记

首先贴出答案

问题 :找不到libmysqlclient.18.dylib,把mysql安装目录的这个文件link到/usr/lib下:

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/

 

安装过程

第一次   问题

ImportError:

dlopen(/Users/aj/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-ix86_64.egg-tmp/_mysql.so,2):

no suitable image found.  

Did find:   

/Users/aj/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-ix86_64.egg-tmp/_mysql.so: mach-o,

but wrong architecture

 

这时因为32位和64位的问题   stackoverflow对这个问题讲的很详细

http://stackoverflow.com/questions/7335853/mysql-python-installation-problems-on-mac-os-x-lion

 

不过,我按他提供的方法尝试了很多遍 ,没成功!!!应该是我之前安装过Mamp  可能和mysql有冲突,一天过后没结果,没办法,重装了系统,悲剧再次到来

 

第二个问题

xcode4.2无法安装,只是提示

'Install Failed' UI displayed message:'An unknown installation error occurred.

 

The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.'.

 

无奈,无奈,无奈  用gcc替代了它--(正在下载4.3试试能不能成功安装)

 

然后重新安装Mysql x64 安装 mysql-python

这次的问题让我欣慰了好多,因为google答案好多 

第三个问题 

ImportError: dlopen(/Users/goodspeed/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib

  Referenced from: /Users/goodspeed/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so

  Reason: image not found

 

当然方法多不一定靠谱  最靠谱的一个答案是

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/

成功了!!!

 

参考的文章(包括安装django)

http://www.cnblogs.com/TsengYuen/archive/2011/12/07/2279010.html

http://stackoverflow.com/questions/7335853/mysql-python-installation-problems-on-mac-os-x-lion

http://decoding.wordpress.com/2012/01/23/how-to-setup-django-and-mysql-python-on-mac-os-x-lion/

http://hackercodex.com/2011/08/30/python-install-django-on-mac-osx-lion-10.7/

你可能感兴趣的:(python)