问题描述
我在Mac OSX Mountain Lion上构建MySQLdb时遇到问题。从OSX Lion升级到OSX Mountain Lion后,我也下载并安装了Xcode 4.4。然后,我进入了首选项>下载Xcode并安装了命令行工具。
我已经下载了MySQL-python版本。 1.2.3来自
当我运行
python setup.py build
我得到以下讯息:
运行build
运行build_py
复制MySQLdb / release.py - > build / lib.macosx-10.6-intel-2.7 / MySQLdb
正在运行build_ext
正在建立'_mysql'扩展
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 / include -I / Library / Frameworks / Python.framework /版本/ 2.7 / include / python2.7 -c _mysql.c -o build / temp.macosx-10.6-intel-2.7 / _mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
无法执行gcc-4.2:没有这样的文件或目录
错误:命令'gcc-4.2'失败,退出状态1
但是,gcc存在。当我运行
gcc
我得到
i686-apple-darwin11-llvm-gcc-4.2:没有输入文件
以下是我发现的一个类似问题,但它的解决方案正是我已经完成的工作, 't为我工作。
我在使用Ruby时遇到类似的问题在Rails 3.2.7上。
我也将系统升级到Mountain Lion,安装了Xcode 4.4.1并下载了命令行工具。
在命令行中,我收到一条错误消息说这是不可能找到文件: /usr/bin/gcc-4.2
(我现在无法粘贴精确的输出,我很抱歉) p>
我有一个 / usr / bin / gcc
,它的版本是 i686-apple- darwin11-llvm-gcc-4.2(GCC)4.2.1
我解决了这个问题, Ruby脚本的名字是:
sudo ln -s / usr / bin / gcc / usr / bin / gcc- 4.2
之后,一切正常。
I'm having trouble building MySQLdb on Mac OSX Mountain Lion. After upgrading to OSX Mountain Lion from OSX Lion, I have downloaded and installed Xcode 4.4 also. Then, I went to Preference > Downloads of the Xcode and installed Command Line Tools.
I've downloaded MySQL-python ver. 1.2.3 from http://sourceforge.net/projects/mysql-python/
When I run
python setup.py build
I get below message:
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
running build_ext
building '_mysql' extension
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/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-common -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
However, the gcc exists. When I run
gcc
I get
i686-apple-darwin11-llvm-gcc-4.2: no input files
Below is a similar question that I have found but its solution, which is exactly what I have done already, doesn't work for me.
How to install MySQLdb on Mountain Lion
I've had a similar problem while working with Ruby On Rails 3.2.7.I too had upgraded the system to Mountain Lion, installed Xcode 4.4.1 and downloaded the Command Line Tools.
On the command line I got an error message saying it was impossible to find the file: /usr/bin/gcc-4.2
(I can't paste the precise output right now, I'm sorry).
I did have a /usr/bin/gcc
and its version was i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1
I solved the problem by symlinking the file in the same directory and giving it the name the Ruby script was looking for:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
After that, everything worked fine.
这篇关于Mac OSX Mountain Lion上的GCC-4.2错误,无法安装mysql-python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!