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

yipeiwu_com6年前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判断一个三位数是否为水仙花数的示例

如下所示: daffodil = int(input('请输入一个三位数:')) if daffodil == pow(daffodil // 100 , 3) + pow(daff...

Python 日志logging模块用法简单示例

Python 日志logging模块用法简单示例

本文实例讲述了Python 日志logging模块用法。分享给大家供大家参考,具体如下: demo.py(日志,输出到控制台): import logging # 导入loggin...

opencv调整图像亮度对比度的示例代码

opencv调整图像亮度对比度的示例代码

图像处理 图像变换就是找到一个函数,把原始图像矩阵经过函数处理后,转换为目标图像矩阵.   可以分为两种方式,即像素级别的变换和区域级别的变换 Point operators (p...

浅析Python中的多条件排序实现

浅析Python中的多条件排序实现

多条件排序及itemgetter的应用 曾经客户端的同事用as写一大堆代码来排序,在得知Python排序往往只需要一行,惊讶无比,遂对python产生浓厚的兴趣。 之前在做足球的积分榜的...

python对离散变量的one-hot编码方法

我们在进行建模时,变量中经常会有一些变量为离散型变量,例如性别。这些变量我们一般无法直接放到模型中去训练模型。因此在使用之前,我们往往会对此类变量进行处理。一般是对离散变量进行one-h...