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

相关文章

Pandas之Dropna滤除缺失数据的实现方法

约定: import pandas as pd import numpy as np from numpy import nan as NaN 滤除缺失数据 pandas的设计目...

Python3中的列表生成式、生成器与迭代器实例详解

本文实例讲述了Python3中的列表生成式、生成器与迭代器。分享给大家供大家参考,具体如下: 列表生成式 Python内置的一种极其强大的生成列表 list 的表达式。返回结果必须是列表...

python多进程操作实例

python多进程操作实例

由于CPython实现中的GIL的限制,python中的多线程其实并不是真正的多线程,如果想要充分地使用多核CPU的资源,在python中大部分情况我们需要使用多进程。 这也许就是pyt...

python实现超市商品销售管理系统

python实现超市商品销售管理系统

本文实例为大家分享了python超市商品销售管理系统的具体代码,供大家参考,具体内容如下 class Goods(object): def __init__(self, id, n...

Python写入数据到MP3文件中的方法

本文实例讲述了Python写入数据到MP3文件中的方法。分享给大家供大家参考。具体分析如下: 通过Mp3的Id3V1数据段的数据来修正Mp3文件的正确名字,但是,有时候这个数据断中的数据...