简体   繁体   English

安装scikit:找不到gcc-4.2,而是使用Clang

[英]Installing scikit: gcc-4.2 not found, using Clang instead

When trying to install scikit on my Mac (OS X Lion) I stumbled upon this error: 当我试图在我的Mac(OS X Lion)上安装scikit时,我偶然发现了这个错误:

gcc-4.2 not found, using clang instead. 找不到gcc-4.2,而是用clang代替。

I searched how to fix this and it seems that the environment variable CC is not correctly set. 我搜索了如何解决这个问题, 似乎没有正确设置环境变量CC。 My question now is, how can I change this and to what do I have to change this? 我现在的问题是,我怎样才能改变这个以及我有什么要改变它? In my /usr/lib/ I do see the g++, gcc, llvm-g++-4.2 and llvm-gcc-4.2 executables. 在我的/usr/lib/我确实看到了g ++,gcc,llvm-g ++ - 4.2和llvm-gcc-4.2可执行文件。 Also when I check env I don't see the CC variable. 当我检查env我没有看到CC变量。 Even when I try to export CC=gcc I don't see it with the env command. 即使我尝试导出CC = gcc,我也没有用env命令看到它。

There are multiple ways of doing this: 有多种方法可以做到这一点:

  1. If you are using make to compile the sources, use the following command: 如果使用make编译源代码,请使用以下命令:

     make CC=/path/to/gcc CXX=path/to/g++ make CC=/path/to/gcc CXX=path/to/g++ install etc. 
  2. You could permanently change your default compilers by: 您可以通过以下方式永久更改默认编译器:

     cd /usr/bin rm cc c++ gcc g++ ln -s gcc-4.2 cc ln -s gcc-4.2 gcc ln -s c++-4.2 c++ ln -s g++-4.2 g++ 

You should also give clang a try, though - it's not bad at all, and in many cases is known to produce equivalent or better-optimized programs than gcc . 你应该尝试一下clang - 虽然它并不坏,并且在许多情况下已知产生与gcc相当或更好的程序。

If scikits is explicitly looking for gcc-4.2, it sounds like it's hardcoded in the setup procedure (bad idea imo). 如果scikits 明确地寻找gcc-4.2,听起来它在设置过程中是硬编码的(坏主意imo)。

I would then just go for the symlink solution; 然后我会选择符号链接解决方案; a bit different than my comment or Ramneek's answer, but pretty much the same: 与我的评论或Ramneek的答案略有不同,但几乎相同:

sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2

gcc and such shouldn't be in /usr/lib/ , but (also) in /usr/bin/ . gcc等不应该在/usr/lib/ ,而且(也)在/usr/bin/ The ones in /usr/lib/ are subdirectories, the ones in /usr/bin/ are the executables. /usr/lib/中的子目录是子目录, /usr/bin/中的子目录是可执行文件。

It may very well be that you have the libraries in those subdirectories, but not the actual executables and header files. 很可能你在这些子目录中有库,但不是实际的可执行文件和头文件。

Have you installed the command-line tools during your XCode installation? 您是否在XCode安装期间安装了命令行工具?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装bcrypt时,“ gcc-4.2”失败,退出状态为1 - 'gcc-4.2' failed with exit status 1 when installing bcrypt 在OSX 10.7上使用virtualenv中的pip时出现gcc-4.2错误 - gcc-4.2 error when using pip in virtualenv on OSX 10.7 gcc-4.2因退出状态1而失败 - gcc-4.2 failed with exit status 1 为什么pip安装程序希望gcc-4.2是OS X Lion中gcc编译器的名称? - Why does the pip installer expect gcc-4.2 to be the name of the gcc compiler in OS X Lion? Mac OS-X Mountain Lion上出现GCC-4.2错误,无法使用pip / virtualenv安装某些软件包 - GCC-4.2 error on Mac OS-X Mountain Lion, unable to install some packages with pip / virtualenv MySQLdb Python连接器构建和安装命令'gcc-4.2'失败,退出状态为255 - MySQLdb Python connector building and installation command 'gcc-4.2' failed with exit status 255 MySQL-python,错误:命令'gcc-4.2'失败,退出状态为1 - MySQL-python, error: command 'gcc-4.2' failed with exit status 1 在 OSX 10.6 和 gcc 4.0 和 4.2 上安装 Python 模块时出现问题 - Issue installing Python module on OSX 10.6 and with gcc 4.0 and 4.2 在Anaconda中安装和使用scikit-learn的问题 - Problems with installing and using scikit-learn in Anaconda 使用字母代替单词作为特征的Scikit SGDClassifier - Scikit SGDClassifier using letters as features instead of words
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM