Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
叮当声错误:未知参数:'-mno fused madd'(python包安装失败)_Python_Clang_Pip_Osx Mavericks - Fatal编程技术网

叮当声错误:未知参数:'-mno fused madd'(python包安装失败)

叮当声错误:未知参数:'-mno fused madd'(python包安装失败),python,clang,pip,osx-mavericks,Python,Clang,Pip,Osx Mavericks,在Mavericks 10.9上尝试通过pip安装psycopg2时,出现以下错误: clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] 不确定如何继续,并已在此处和其他地方搜索此特定错误。非常感谢您的帮助 以下是pip的完整输出: $ pip install psycopg2 Downloading/unpacking psycopg2

在Mavericks 10.9上尝试通过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

更新:10.9.3解决了系统CPython的问题

这是由苹果最新的叮当更新引起的,该更新今天随Xcode 5.1发布,影响了很多很多人,所以希望很快会出现修复

更新:没想到这会引起如此多的关注,但这里有更多的细节:Clang3.4Apple提供了未知标志上的默认错误,但CPython使用它最初编译时使用的同一组标志构建模块。系统CPython编译时使用了几个clang未知的标志,因此导致了这个问题。以下是当前的Mavericks 10.9.2 CPython编译标志:

-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -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
要解决此问题,您有几个选项:

将ARCHFLAGS=-Wno error=将来未使用的命令行参数硬错误添加到编译标志中。 通过CFLAGS= 从sysconfigdata.py中删除不支持的标志,如另一个答案中所述。 使用编译一个新的python。 等待下一次OS X更新,据说它包括重新编译的Python/Ruby,以消除系统运行时的这个问题。
下面是一个解决方法,涉及从python安装中删除标志

在/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7//\u sysconfigdata.py中设置了-mfused madd/-mno fused madd标志

编辑此文件并删除对该标志的所有引用编译应能正常工作:

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
您还需要删除相应的_sysconfigdata.pyc和_sysconfigdata.pyo文件-至少在我的系统上,这些文件没有自动重建:

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

请注意,您必须使用root访问权限进行这些更改。

您可以在编译之前通过设置以下环境变量告诉clang不要将此作为错误提出:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
然后pip安装psycopg2应该可以工作

我在尝试pip安装lxml时也遇到了同样的问题

编辑:如果您是以超级用户身份安装的,如果您试图附加到/Library/Python/2.7/site-packages,即OS X附带的本机Apple factory安装的Python发行版,而不是您随后自行安装的其他Python发行版,那么您需要执行以下操作:,正如@Thijs Kuipers在以下评论中所述:

sudo -E pip install psycopg2
或同等名称,用于替代psycopg2的任何其他包名

更新[2014-05-16]:苹果公司已通过OS X 10.9.3中更新的系统Pythons 2.7、2.6和2.5修复了此问题,因此在使用最新的Mavericks和Xcode 5.1+时不再需要解决此问题。但是,到目前为止,如果您使用的是Xcode 5.1+,OS X 10.8.X Mountain Lion(目前为10.8.5)仍然需要解决这个问题。

我使用了python软件包。 重新编译后效果良好。

xCode 5.1

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

我还像@user3405479那样编辑了系统python的原始编译标志的概念。我没有使用编辑器,而是使用命令行工具在inode发生更改的地方编辑文件。我还编译了新的pyo和pyc文件,而不是将它们删除

以下命令以root用户身份运行,例如在sudo-i下

pushd/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7

sed's/-mno fused madd//g'\u sysconfigdata.py\ |diff-p _sysconfigdata.py-| patch-b

python-m py_compile_sysconfigdata.py

python-OO-mpy\u compile\u sysconfigdata.py


popd

我使用自制软件安装postgresql,然后想在Mavericks上安装psycopg2到python 2.7提供的系统中。为了让它发挥作用,我最终运行了以下程序:

sudo ARCHFLAGS="-arch x86_64" CFLAGS=-Wunused-command-line-argument-hard-error-in-future pip install psycopg2

上述解决方案对我都不起作用。我的情况略有不同。当我收到此错误消息时,我正试图通过自制程序安装rdiff备份

我显然有苹果默认的python 2.7.5@/usr/bin/python和自制的python 2.7.6@/usr/local/ceral/python/2.7.6/bin/python,但错误来自苹果的python

为了解决这个问题,我基本上切换了python二进制文件

我是通过sudo做的:

cp/usr/bin/python/usr/bin/python\u orig ln-s/usr/local/ceral/python/2.7.6/bin/python/usr/bin/python 然后,“brew安装rdiff备份”成功,没有任何错误


最后,我做了mv/usr/bin/python\u orig/usr/bin/python来还原所有内容。

关于_sysconfigdata.py修复程序的变体:使用虚拟环境

cp/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7//u sysconfigdata.py${VIRTUAL_ENV}/lib/python2.7//u sysconfigdata.py

然后在${VIRTUAL\u ENV}/lib/python2.7//u sysconfigdata.py编辑您的副本

我删除了所有出现的'-mn' o-fused-madd’和构建在该虚拟环境中工作


不需要根

至少苹果知道这一点,因为Xcode 5.1编译器一节将讨论这个问题。希望在下一次操作系统更新中更新Python和Ruby,祝好运!。还需要注意的是,-Wno error=unused命令行参数hard error in future标志是一个临时的解决方法,希望在系统Python修复后它会消失

如果您是像我这样的Python软件包维护人员,并且希望为您的用户节省自己解决此问题的麻烦,那么除了提供进入setup.py文件的二进制轮子/鸡蛋之外,还有一个解决方案:

从distutils.command.build\u ext导入build\u ext 导入子流程 导入系统 OS X 10.9.2和Xcode 5.1的变通方法+ 最新的clang将无法识别的命令行选项视为错误,并且 Python CFLAGS变量包含无法识别的变量,例如-mno-fused-madd。 请参阅Xcode 5.1发行说明编译器部分和 http://stackoverflow.com/questions/22313407 更多细节。这个变通办法 遵循中建议的方法http://stackoverflow.com/questions/724664. 类构建\外部\子类构建\外部: def生成扩展自身: 如果sys.platform==“darwin”: 测试将实际用于查看其是否喜欢标志的编译器 proc=subprocess.Popenself.compiler.compiler+['-v'], stdout=subprocess.PIPE,stderr=subprocess.PIPE, 通用新行=真 stdout,stderr=proc.communicate clang_mesg=clang:error:未知参数:'-mno fused madd' 如果proc.returncode和stderr.splitlines[0],则开始使用CLANG\u mesg: 对于self.extensions中的ext: 使用临时解决方法忽略无效的编译器选项 希望-mno fused madd在这个解决方案之前离开! ext.extra_compile_args+=['-Wno error=将来未使用的命令行参数硬错误'] build\u ext.build\u extensions self 设置 name=mypackage, ... cmdclass={'build\u ext':build\u ext\u subclass}, ...
您可能正在使用Python 2.7.5

$ python

Python 2.7.5 (default, Aug 25 2013, 00:04:04)  [GCC 4.2.1 Compatible
Apple LLVM 5.0 (clang-500.0.68)] on darwin
最简单的解决方案请访问www.python.org并安装与LLVM 5.1兼容的python 2.7.6

然后干杯您的旧虚拟环境rmvirtualenv{virtual_env_name}

然后创建一个新的虚拟环境

mkvirtualenv --no-site-packages -p/Library/Frameworks/Python.framework/Versions/2.7/bin/python {virtual_env_name}

在此之后,pip应该可以正常工作。

对我来说,坏标志是在包的Makefile中显式给出的。因此,我必须编辑makefile以从出错包中删除无法识别的标志。

Amazon Linux[AWS EC2] 尝试在Amazon Linux AMI 2016.09版上pip安装paramiko时,出现了一个错误,其中包含指向此SO帖子的链接。所以,即使它不符合OP的标题,我还是要分享答案

yum install libffi-devel
yum install gcc
yum install openssl-devel
pip install paramiko

升级自制软件并安装unixodbc为我解决了这个问题

brew upgrade
brew install unixodbc


我在构建C库时也遇到了同样的错误:clang:error:unknown参数:'-mno fused madd'…这个问题发生在任何包含C模块的Python包中,而不仅仅是psycopg2。我在安装带pip的greenlet时遇到了这个问题。这个修好了,谢谢。这对我来说是一个即时的修好,谢谢!请参阅Paul Kehrer的答案,以了解有关问题来源的解释。如果以root用户身份安装,则需要为root用户设置标志。我必须向sudo添加-E标志,以加载root执行的环境变量,如@ErikAndren所说。所以首先是上面提到的两个出口声明,然后是sudo-E doSomething。用枕头救了我的命。谢谢@保罗,谢谢你的消息。有没有一种方法可以让你及时了解这个bug的状态?我很乐意在修复可用后尽快更新clang。这不是一个clang bug,这是Apple的发行版bug。苹果不应该发布一个Python版本,该版本的设置与Clang3.4不兼容。苹果更新Python解释器后,它得到了正确的修复。您可以通过运行Python config-cflags来验证这一点。当在苹果的默认Python上运行时,它会显示Clang3.4所不知道的选项。如果我已经更新到Xcode 5.1,有解决方案吗?按照上面的建议将这些导出添加到bashrc中似乎并没有解决问题。对Sean来说:在我的Mac上,我有~/.bash_配置文件不是bashrc,但这需要你重新启动shell才能生效。这确实有效!我必须同时删除_sysconfigdata.pyc和_sysconfigdata.pyogreat,这有助于我安装枕头我在通过pip安装psycog2时遇到了很多问题,这为我解决了这个问题。非常感谢。如果您使用的是sudo,那么在设置环境变量之前需要先执行sudo。i、 例如,sudo ARCHFLAGS=。。。pip安装…用于安装pycrypto。谢谢在苹果修复Python安装之前,这似乎是最实用、最权威的解决方案。谢谢您的完整说明!可能想要提取需求 在敬酒之前从你的旧环境中;pip freeze>requirements.txt