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 描述符(Descriptor)入门

很久都没写 Flask 代码相关了,想想也真是惭愧,然并卵,这次还是不写 Flask 相关,不服你来打我啊(就这么贱,有本事咬我啊 这次我来写一下 Python 一个很重要的东西,即 D...

举例讲解Python面向对象编程中类的继承

python创建一个类很简单只需要定义它就可以了. class Cat: pass 就像这样就可以了,通过创建子类我们可以继承他的父类(超类)的方法。这里重新写一下cat...

numpy数组广播的机制

numpy数组广播的机制

numpy数组的广播功能强大,但是也同时让人疑惑不解,现在让我们来谈谈其中的原理。 广播原则: 如果两个数组的后缘维度(即:从末尾开始算起的维度)的轴长相符或其中一方的长度为1,则认为它...

Python元组及文件核心对象类型详解

元组 元组是不可变类型,以()表示,是任意对象的有序集合,同样是序列的一种,index和count方法分别是取元素,统计元素个数。 语法比如(2,3)就是一个元组。元组与列表如此类似,...

PyQt5 QListWidget选择多项并返回的实例

参考Stack Overflow Python: How to query multiple selected items in QListWidget in PyQt f...