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

yipeiwu_com5年前Python基础

在我的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

相关文章

将Python字符串生成PDF的实例代码详解

将Python字符串生成PDF的实例代码详解

笔者在今天的工作中,遇到了一个需求,那就是如何将Python字符串生成PDF。比如,需要把Python字符串‘这是测试文件'生成为PDF, 该PDF中含有文字‘这是测试文件'。 ...

python实现电脑自动关机

0、前言 在以前读书的时候,实验室里面要求每天都要关电脑,有时候出去玩得晚了,懒得回实验室关电脑,又没有同学帮忙。于是就想,能不能通过什么手段实现远程关闭电脑。在网上搜索一番后,决定用...

Python实现拼接多张图片的方法

本文实例讲述了Python实现拼接多张图片的方法。分享给大家供大家参考。具体分析如下:   这里所述计划实现如下操作:   ① 用Latex写原始博文,生成PDF文档...

Python操作MongoDB数据库的方法示例

本文实例讲述了Python操作MongoDB数据库的方法。分享给大家供大家参考,具体如下: >>> import pymongo >>> clie...

Python3.7安装keras和TensorFlow的教程图解

Python3.7安装keras和TensorFlow的教程图解

win10 Python3.7安装keras深度学习集成包 TensorFlow 和Ubuntu下安装keras 在win10下安装 安装时必须检查你的python是否为64位,32位不...