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安装本地whl的实例步骤

python安装本地whl的实例步骤

1.用管理员打开cmd 2.首先通过pip命令安装wheel pip install wheel 如果提示'pip'不是内部或外部命令,也不是可运行的程序或批处理文件 ①将pytho...

Django中使用group_by的方法

本文实例讲述了Django中使用group_by的方法。分享给大家供大家参考。具体分析如下: 在Django中怎样使用group_by语句呢?找了很多资料,都没有看到好的,在这里分享两种...

python 文件的基本操作 菜中菜功能的实例代码

python  文件的基本操作 菜中菜 文件操作 ​ open():打开 ​ file:文件的位置(路径) ​ mode:操作文件模式 &#...

tensorflow 使用flags定义命令行参数的方法

tf定义了tf.app.flags,用于支持接受命令行传递参数,相当于接受argv。 import tensorflow as tf #第一个是参数名称,第二个参数是默认值,第三个...

pandas中遍历dataframe的每一个元素的实现

假如有一个需求场景需要遍历一个csv或excel中的每一个元素,判断这个元素是否含有某个关键字 那么可以用python的pandas库来实现。 方法一: pandas的dataframe...