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

相关文章

Django压缩静态文件的实现方法详析

django静态文件配置原理 静态文件配置就是为了让用户请求时django服务器能找到静态文件返回。 首先要理解几个概念: 媒体文件:用户上传的文件 静态文件:css,js,...

Python使用三种方法实现PCA算法

Python使用三种方法实现PCA算法

主成分分析,即Principal Component Analysis(PCA),是多元统计中的重要内容,也广泛应用于机器学习和其它领域。它的主要作用是对高维数据进行降维。PCA把原先的...

我们为什么要减少Python中循环的使用

我们为什么要减少Python中循环的使用

前言 Python 提供给我们多种编码方式。 在某种程度上,这相当具有包容性。 来自于任何语言的人都可以编写 Python。 然而,学习写一门语言和以最优的方式写一门语言是两件不同...

Python文件读取的3种方法及路径转义

1.文件的读取和显示 方法1: 复制代码 代码如下:  f=open(r'G:\2.txt')  print f.read()  f.close() 方法...

pip 安装库比较慢的解决方法(国内镜像)

对于Python开发用户来讲,PIP安装软件包是家常便饭。但国外的源下载速度实在太慢,浪费时间。而且经常出现下载后安装出错问题。 所以把PIP安装源替换成国内镜像,可以大幅提升下载速度,...