码迷,mamicode.com
首页 > 数据库 > 详细

Mac下安装 mysqldb 出错

时间:2014-09-05 23:43:02      阅读:313      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   ar   for   div   

Last login: Sun Aug 10 21:07:51 on ttys001
SandymatoMacBook-Pro:MySQL-python-1.2.4b4 sandy$ sudo python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
running build_ext
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    setup(**metadata)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.macosx-10.6-intel/egg/setuptools/command/build_ext.py", line 46, in run
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 307, in run
    customize_compiler(self.compiler)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/sysconfig.py", line 170, in customize_compiler
    _osx_support.customize_compiler(_config_vars)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_osx_support.py", line 418, in customize_compiler
    _find_appropriate_compiler(_config_vars)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_osx_support.py", line 191, in _find_appropriate_compiler
    "Cannot locate working compiler")
SystemError: Cannot locate working compiler
SandymatoMacBook-Pro:MySQL-python-1.2.4b4 sandy$ 

安装mysqldb:

MySQL for Python http://sourceforge.net/projects/mysql-python/
tar zxvf MySQL-python

cd MySQL-python-1.2.4b4

python setup.py install 报了以上错误

 

原因:电脑没有安装gcc

gcc 是c 语言的编译器,python-mysql 有一部分代码实现是c 做的,要用gcc 编译

 

安装gcc :

https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg 

 

Mac下安装 mysqldb 出错

标签:style   blog   http   color   os   io   ar   for   div   

原文地址:http://www.cnblogs.com/sandycoding/p/3958847.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!