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 minidom模块用法示例【DOM写入和解析XML】

本文实例讲述了Python minidom模块用法。分享给大家供大家参考,具体如下: 一、DOM写XML文件 # -*- coding:utf-8 -*- #!python3 #导入...

浅谈python标准库--functools.partial

浅谈python标准库--functools.partial

一.简单介绍:  functools模块用于高阶函数:作用于或返回其他函数的函数。一般而言,任何可调用对象都可以作为本模块用途的函数来处理。  functools....

对Python中type打开文件的方式介绍

这几天在看《利用Python进行数据分析》,在第六章数据加载、存储、与文件格式中遇到个小问题。 在Linux访问文件是用:!cat ch06/ex1.csv 在Windows命令行中使用...

在Python中给Nan值更改为0的方法

如下所示: import pandas as pd df1 = pd.DataFrame([{'col1':'a', 'col2':1}, {'col1':'b', 'col2':2...

Python Flask框架扩展操作示例

本文实例讲述了Python Flask框架扩展操作。分享给大家供大家参考,具体如下: 请求上下文(request context) Flask有两大核心:Werkzeug和Jinja2。...