【问题标题】:mountain lion os X python mysql install [closed]山狮os X python mysql安装[关闭]
【发布时间】:2013-02-08 03:40:56
【问题描述】:

从这里下载的 tar 文件

http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/

并按照http://decoding.wordpress.com/2012/01/23/how-to-setup-django-and-mysql-python-on-mac-os-x-lion/ 的指南进行操作。

已成功安装 Django。 更改了 mysql_config = /usr/local/mysql-5.6.10-osx10.7-x86_64/mysql_config 中的 site.cfg 配置

然后运行 ​​sudo python setup.py build

得到这个输出

dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo)    is setuid or setgid
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.6-intel-2.7
creating build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
creating build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.6-intel-2.7
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -Dversion_info=    (1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql-5.6.10-osx10.7-x86_64/include -    I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o     build/temp.macosx-10.6-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1

这些错误来自哪里?找到了雪豹的解决方案,但没有找到山狮的解决方案。谢谢。

【问题讨论】:

  • 您是否尝试过使用brewpip 安装这些?因为它会否定下载 tars 等的需要。如果您尝试过并且没有涵盖它,请道歉。
  • 还没试过,终端还是新手
  • 你试过安装gcc-4.2吗?
  • 您要么没有从 Xcode 安装 command-line-tools,要么不再拥有 gcc-4.2distutils 确定您需要 gcc-4.2,因为那是用于编译此 python 的编译器,您正在使用它来编译此扩展。要检查这一点,请尝试from distutils import sysconfig; sysconfig.get_config_var('LDSHARED')。您可以尝试修改此配置,以及CC 的配置,但不完全推荐。
  • 使用这个答案解决了它stackoverflow.com/questions/7949024/…

标签: python mysql installation osx-mountain-lion


【解决方案1】:

您似乎没有安装gcc-4.2。请记住,它可能被称为不同的东西。在我的机器上,gcc 可执行文件名为gcc-apple-4.2

【讨论】:

    猜你喜欢
    • 2013-06-10
    • 1970-01-01
    • 2013-02-24
    • 1970-01-01
    • 2014-06-25
    • 2012-08-03
    • 2012-09-03
    • 2012-11-08
    • 2013-08-02
    相关资源
    最近更新 更多