使用pip安装numpy时出现错误 'cc1: error: unrecognised debug output level "record-gcc-switches
当我尝试在一个虚拟环境中安装numpy时(我不能在整个系统上安装),结果出现了以下错误:
RuntimeError: Broken toolchain: cannot link a simple C program
这里有一些看起来有用的输出:
$ pip install --upgrade numpy | grep -i "error\|gcc\|warning"
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
C compiler: gcc -pthread -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC
gcc: _configtest.c
cc1: error: unrecognised debug output level "record-gcc-switches"
cc1: error: unrecognised debug output level "record-gcc-switches"
cc1: error: unrecognised debug output level "record-gcc-switches"
cc1: error: unrecognised debug output level "record-gcc-switches"
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
C compiler: gcc -pthread -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC
gcc: _configtest.c
cc1: error: unrecognised debug output level "record-gcc-switches"
cc1: error: unrecognised debug output level "record-gcc-switches"
cc1: error: unrecognised debug output level "record-gcc-switches"
cc1: error: unrecognised debug output level "record-gcc-switches"
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
我在openSUSE 13.1(x86_64)上运行的是gcc版本4.4.7。
1 个回答
0
把gcc更新到新版本(比如4.7.4)可以解决这个问题。