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探索之Metaclass初步了解

先以一个大牛的一段关于Python Metapgramming的著名的话来做开头: Metaclasses are deeper magic than 99% of users sho...

python函数局部变量用法实例分析

本文实例讲述了python函数局部变量用法。分享给大家供大家参考。具体分析如下: 当你在函数定义内声明变量的时候,它们与函数外具有相同名称的其他变量没有任何关系,即变量名称对于函数来说是...

python实现微信每日一句自动发送给喜欢的人

本文实例为大家分享了python实现微信每日一句自动发送的具体代码,供大家参考,具体内容如下 参考了一篇博客:教你使用python实现微信每天给女朋友说晚安 代码: # -*- co...

Python学习笔记之Django创建第一个数据库模型的方法

Python学习笔记之Django创建第一个数据库模型的方法

Django里面集成了SQLite的数据库,对于初期研究来说,可以用这个学习。 第一步,创建数据库就涉及到建表等一系列的工作,在此之前,要先在cmd执行一个命令: python ma...

Python每天必学之bytes字节

Python中的字节码用b'xxx'的形式表示。x可以用字符表示,也可以用ASCII编码形式\xnn表示,nn从00-ff(十六进制)共256种字符。 一、基本操作 下面列举一下字节的基...