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

相关文章

pygame实现俄罗斯方块游戏(AI篇2)

pygame实现俄罗斯方块游戏(AI篇2)

继续pygame实现俄罗斯方块游戏(AI篇1)的代码更新 一、消除后才做评价 上一篇我们是对方块落下的位置和落下后出来的空洞进行了评价,但是这些评价都是没有计算消除的,以至于机器人现在不...

Python3基础教程之递归函数简单示例

概述 递归函数即直接或间接调用自身的函数,且递归过程中必须有一个明确的递归结束条件,称为递归出口。递归极其强大一点就是能够遍历任意的,不可预知的程序的结构,比如遍历复杂的嵌套列表。...

Python解决两个整数相除只得到整数部分的实例

在python中进行两个整数相除的时候,在默认情况下都是只能够得到整数的值 解决方法: 1. 修改被除数的值为带小数点的形式即可得到浮点值 2.在文件头部引入 from __futu...

python检索特定内容的文本文件实例

windows环境下python2.7 脚本指定一个参数作为要检索的字符串 例如: >find.py ./ hello # coding=utf-8 import os im...

python和flask中返回JSON数据的方法

python和flask中返回JSON数据的方法

在python中可以使用json将数据格式化为JSON格式: 1.将字典转换成JSON数据格式: s=['张三','年龄','姓名'] t={} t['data']=s ret...