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编程实现控制cmd命令行显示颜色的方法示例

Python编程实现控制cmd命令行显示颜色的方法示例

本文实例讲述了Python编程实现控制cmd命令行显示颜色的方法。分享给大家供大家参考,具体如下: 基于win7 + python3.4 运行效果: import ctypes i...

Python异常学习笔记

异常(exceptions)是Python中一种非常重要的类型,它和语法错误不同,是在程序运行期间引发的错误。Python中内置了很多异常,如IOError,NameError,Keyb...

Python函数的周期性执行实现方法

本文实例讲述了Python函数的周期性执行实现方法。分享给大家供大家参考,具体如下: 需要用到python的sched模块: #coding=utf-8 import time,sc...

python 3.74 运行import numpy as np 报错lib\site-packages\numpy\__init__.py

安装完 anaconda 运行如下代码执行不了 import numpy as np import os,sys #获取当前文件夹,并根据文件名 def path(fileName...

Python下的subprocess模块的入门指引

Python下的subprocess模块的入门指引

在熟悉了Qt的QProcess以后,再回头来看python的subprocess总算不觉得像以前那么恐怖了。 和QProcess一样,subprocess的目标是启动一个新的进程并与之进...