在Mavericks 10.9上try 通过pip安装psycopg2时,我遇到以下错误:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

不知道如何继续,并且已经在这里和其他地方搜索了这个特定的错误.非常感谢您的帮助!

以下是pip的完整输出:

$ pip install psycopg2
Downloading/unpacking psycopg2
  Downloading psycopg2-2.5.2.tar.gz (685kB): 685kB downloaded
  Running setup.py (path:/private/var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip_build_tino/psycopg2/setup.py) egg_info for package psycopg2

Installing collected packages: psycopg2
  Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    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 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090303 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.3.3/include -I/usr/local/Cellar/postgresql/9.3.3/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-intel-2.7/psycopg/psycopgmodule.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
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip_build_tino/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip-bnWiwB-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib.macosx-10.9-intel-2.7

creating build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/__init__.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/_json.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/_range.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/errorcodes.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/extensions.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/extras.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/pool.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/psycopg1.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

copying lib/tz.py -> build/lib.macosx-10.9-intel-2.7/psycopg2

creating build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/__init__.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/dbapi20.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/dbapi20_tpc.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_async.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_bug_gc.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_bugX000.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_cancel.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_connection.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_copy.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_cursor.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_dates.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_extras_dictcursor.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_green.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_lobject.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_module.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_notify.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_psycopg2_dbapi20.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_quote.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_transaction.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_types_basic.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_types_extras.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/test_with.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/testconfig.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

copying tests/testutils.py -> build/lib.macosx-10.9-intel-2.7/psycopg2/tests

running build_ext

building 'psycopg2._psycopg' extension

creating build/temp.macosx-10.9-intel-2.7

creating build/temp.macosx-10.9-intel-2.7/psycopg

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 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.2 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090303 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql/9.3.3/include -I/usr/local/Cellar/postgresql/9.3.3/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-intel-2.7/psycopg/psycopgmodule.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

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip_build_tino/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip-bnWiwB-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/0z/ljjwsjmn4v9_zwm81vhxj69m0000gn/T/pip_build_tino/psycopg2

推荐答案

通过在编译前设置以下环境变量,可以告诉clang不要将其作为错误引发:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

那就行了.

我试着pip install lxml岁时也有同样的经历.

编辑:如果您是以超级用户身份安装的(如果您try 附加到/Library/Python/2.7/site-packages,即OS X附带的原生Apple出厂安装的Python发行版,而不是您随后自行安装的其他Python发行版),那么您将需要这样做,如@Thijs Kuipers在以下 comments 中所述:

sudo -E pip install psycopg2

或同等名称,以代替psycopg2.

UPDATE[2014-05-16]:Apple已在OS X 10.9.3版本中使用更新的系统Pythons(2.7、2.6和2.5)修复了此问题,因此在使用最新的Mavericks和Xcode 5.1+时不再需要解决此问题.但是,到目前为止,如果您在OS X 10.8.x(Mountain Lion,当前为10.8.5)使用Xcode 5.1+,则仍然需要解决方法.

Python相关问答推荐

无法使用equals_html从网址获取全文

Polars LazyFrame在收集后未返回指定的模式顺序

时间序列分解

连接两个具有不同标题的收件箱

韦尔福德方差与Numpy方差不同

根据在同一数据框中的查找向数据框添加值

比较2 PD.数组的令人惊讶的结果

如何将双框框列中的成对变成两个新列

如何在Windows上用Python提取名称中带有逗号的文件?

无法使用DBFS File API路径附加到CSV In Datricks(OSError Errno 95操作不支持)

driver. find_element无法通过class_name找到元素'""

多指标不同顺序串联大Pandas 模型

通过ManyToMany字段与Through在Django Admin中过滤

在Python 3中,如何让客户端打开一个套接字到服务器,发送一行JSON编码的数据,读回一行JSON编码的数据,然后继续?

在pandas数据框中计算相对体积比指标,并添加指标值作为新列

python—telegraph—bot send_voice发送空文件

用SymPy在Python中求解指数函数

循环浏览每个客户记录,以获取他们来自的第一个/最后一个渠道

如何在Airflow执行日期中保留日期并将时间转换为00:00

BeatuifulSoup从欧洲志愿者服务中获取数据和解析:一个从EU-Site收集机会的小铲子