1

从这里下载的 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

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

4

1 回答 1

2

看起来你没有gcc-4.2安装。请记住,它可能被称为不同的东西。在我的机器上,调用了 gcc 可执行文件gcc-apple-4.2

于 2013-02-22T14:00:32.570 回答