欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

pip 错误unused-command-line-argument-hard-error-in-future解决办法

程序员文章站 2023-11-20 13:21:46
在我的mac air上,用pip安装一些python库时,偶尔就会遇到一些报错,关于“unused-command-line-argument-hard-error-in-...

在我的mac air上,用pip安装一些python库时,偶尔就会遇到一些报错,关于“unused-command-line-argument-hard-error-in-future”,错误如下:

复制代码 代码如下:

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -denable_dtrace -dmacosx -dndebug -wall -wstrict-prototypes -wshorten-64-to-32 -dndebug -g -fwrapv -os -wall -wstrict-prototypes -denable_dtrace -arch x86_64 -arch i386 -pipe -i/system/library/frameworks/python.framework/versions/2.7/include/python2.7 -c psutil/_psutil_osx.c -o build/temp.macosx-10.9-intel-2.7/psutil/_psutil_osx.o

clang: error: unknown argument: '-mno-fused-madd' [-wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'cc' failed with exit status 1

这样的错误,出现次数多了,每次都去google,不如自己记录一下吧。
原因是:the apple llvm compiler in xcode 5.1 treats unrecognized command-line options as errors. this issue has been seen when building both python native extensions and ruby gems, where some invalid compiler options are currently specified.

解决方法:设置archflags参数,如下:

复制代码 代码如下:

sudo archflags=-wno-error=unused-command-line-argument-hard-error-in-future pip install psutil