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入门及进阶笔记 Python 内置函数小结

内置函数 常用函数 1.数学相关 •abs(x) abs()返回一个数字的绝对值。如果给出复数,返回值就是该复数的模。 复制代码 代码如下: >>>prin...

Python 初始化多维数组代码

    Python中初始化一个5 x 3每项为0的数组,最好方法是:multilist = [[0 for col i...

基于MSELoss()与CrossEntropyLoss()的区别详解

基于MSELoss()与CrossEntropyLoss()的区别详解

基于pytorch来讲 MSELoss()多用于回归问题,也可以用于one_hotted编码形式, CrossEntropyLoss()名字为交叉熵损失函数,不用于one_hotted编...

Python3遍历目录树实现方法

本文实例讲述了Python3遍历目录树的方法。分享给大家供大家参考。具体实现方法如下: import os, fnmatch # 检查一个目录,后者某个包含子目录的目录树,并根据某种...

numpy中的高维数组转置实例

numpy中的高维数组转置实例

numpy中的ndarray很适合数组运算 transpose是用来转置的一个函数,很容易让人困惑,其实它是对矩阵索引顺序的一次调整。原先矩阵是一个三维矩阵,索引顺序是x,y,z,角标...