尝试以多种方式安装psycopg2,但我不断收到与此相似的错误:
$ pip install psycopg2
Downloading/unpacking psycopg2
Downloading psycopg2-2.5.4.tar.gz (682kB): 682kB downloaded
Running setup.py (path:/private/var/folders/6p/0z5pjhdn47b7r2x0c4fjy3tw0000gp/T/pip_build_nir/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.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090304 -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.4/include -I/usr/local/Cellar/postgresql/9.3.4/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/6p/0z5pjhdn47b7r2x0c4fjy3tw0000gp/T/pip_build_nir/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/6p/0z5pjhdn47b7r2x0c4fjy3tw0000gp/T/pip-igitig-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.4 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x090304 -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.4/include -I/usr/local/Cellar/postgresql/9.3.4/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/6p/0z5pjhdn47b7r2x0c4fjy3tw0000gp/T/pip_build_nir/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/6p/0z5pjhdn47b7r2x0c4fjy3tw0000gp/T/pip-igitig-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/6p/0z5pjhdn47b7r2x0c4fjy3tw0000gp/T/pip_build_nir/psycopg2
Storing debug log for failure in /Users/nir/Library/Logs/pip.log
我尝试过很多命令,包括重新安装postgresql和django-toolbelt。似乎没有任何区别,会发生同样的“类型”错误。我还将postgresql包含在$ PATH中:export PYTHONPATH=$PYTHONPATH:/Library/PostgreSQL/9.3/bin/pg_config
我在OSX Maverick。我正在运行python 2.7和django 1.6。
任何想法?
答案 0 :(得分:2)
我实际上并不知道答案,但是,当我使用您遇到问题的所有组件时,我搜索了一下。我碰到了这个:
http://kaspermunck.github.io/2014/03/fixing-clang-error/
所以,你可能会尝试类似的东西:
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install psycopg2
似乎问题是cc命令行包含对cc没有意义的参数,它曾经是一个软错误,但现在它是一个致命的错误。祝你好运!
-g