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

相关文章

破解安装Pycharm的方法

破解安装Pycharm的方法

先准备好安装软件。从官网下载最新的pycharm版本:https://www.jetbrains.com/pycharm/download/download-thanks.html?pl...

Python使用arrow库优雅地处理时间数据详解

前言 大家应该都知道在很多时候我们不得不和时间打交道,但在Python标准库中处理时间的模块其实设计的不是很友好,为什么我会这么说?因为我相信大部分人几乎每次在处理时间数据时一而再,再...

简单介绍Python中的round()方法

 round()方法返回 x 的小数点四舍五入到n个数字。 语法 以下是round()方法的语法: round( x [, n] ) 参数  &nbs...

python 获取utc时间转化为本地时间的方法

方法一: import datetime timenow = (datetime.datetime.utcnow() + datetime.timedelta(hours=8))...

Python实现的选择排序算法原理与用法实例分析

Python实现的选择排序算法原理与用法实例分析

本文实例讲述了Python实现的选择排序算法。分享给大家供大家参考,具体如下: 选择排序(Selection sort)是一种简单直观的排序算法。它的工作原理是每一次从待排序的数据元素中...