clang error: unknown argument: '-mno-fused-madd' (python package installation failure)

后端 未结 14 2789
攒了一身酷
攒了一身酷 2020-11-22 04:43

I get the following error when attempting to install psycopg2 via pip on Mavericks 10.9:

clang: error: unknown argument: \'-mno-fused-madd\' [-W         


        
14条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 05:05

    Here is a work around that involves removing the flag from the python installation.

    In /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py are several places where the -mfused-madd / -mno-fused-madd flag is set.

    Edit this file and remove all of the references to that flag your compilation should work:

    sudo sed -i '.old' 's/ -m\(no-\)\{0,1\}fused-madd //g' /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
    

    You need to delete the corresponding _sysconfigdata.pyc and _sysconfigdata.pyo files as well - at least on my system these files did not automatically get rebuilt:

    cd /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
    sudo rm _sysconfigdata.pyo _sysconfigdata.pyc
    

    Note that have to use root access to make those changes.

提交回复
热议问题