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程序员面试中被问的最多的10道题

我们在为大家整Python程序员面试试题中,发现了一些被面试官问到的最多的一些问题,以下就是本篇内容: Python是个非常受欢迎的编程语言,随着近些年机器学习、云计算等技术的发展,Py...

Python语言编写电脑时间自动同步小工具

Python语言编写电脑时间自动同步小工具

话不多说,小工具需求如下: 功能需求 -- 电脑开机后自动执行时间同步 非功能需求 -- 安装执行简单,无需安装额外环境 一、代码实现 基于以上需求,思路如下:访问网络获取北京时间,然后...

Python解决线性代数问题之矩阵的初等变换方法

定义一个矩阵初等行变换的类 class rowTransformation(): array = ([[],[]]) def __init__(self,array):...

django删除表重建的实现方法

正确的方法如下: 先到数据库把表删掉:drop table 注释django中对应的Model 执行以下命令: python manage.py makemigrations p...

python使用PyGame绘制图像并保存为图片文件的方法

本文实例讲述了python使用PyGame绘制图像并保存为图片文件的方法。分享给大家供大家参考。具体实现方法如下: ''' pg_draw_circle_save101.py dra...