PIP error unused command line line argument hard error in future solution

  • 2020-04-02 13:41:17
  • OfStack

On my Mac Air, when I installed some Python libraries with PIP, I encountered some errors occasionally. The error is as follows:


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

This kind of mistake, appear many times, go to Google every time, as their own record.
The reason is: 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 available.

Solution: set the ARCHFLAGS parameter as follows:


sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install psutil


Related articles: