在Mac OS下安装pygresql时出现clang错误 [英] clang error when installing pygresql under Mac OS

查看:149
本文介绍了在Mac OS下安装pygresql时出现clang错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Mac OS X(10.11.3)下安装PyGreSQL,但是从pip和源代码安装时发生相同的clang错误。

I was trying to install PyGreSQL under Mac OS X(10.11.3), but the same clang error occurs when installing from pip and source.

$ python3 setup.py install
running install
running bdist_egg
running egg_info
writing PyGreSQL.egg-info/PKG-INFO
writing top-level names to PyGreSQL.egg-info/top_level.txt
writing dependency_links to PyGreSQL.egg-info/dependency_links.txt
reading manifest file 'PyGreSQL.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'PyGreSQL.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-intel/egg
running install_lib
running build_py
running build_ext
building '_pg' extension
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPYGRESQL_VERSION=5.0 -DDIRECT_ACCESS -DLARGE_OBJECTS -DDEFAULT_VARS -DESCAPING_FUNCS -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -I/Library/PostgreSQL/9.5/include -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c pgmodule.c -o build/temp.macosx-10.6-intel-3.5/pgmodule.o -O2 -funsigned-char -Wall -Werror
pgmodule.c:3684:3: error: code will never be executed [-Werror,-Wunreachable-code]
                long    num_rows;
                ^~~~~~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1

<安装PyGreSQL时出现a href = http://i.stack.imgur.com/X3Aes.png rel = nofollow> clang错误

我已经在计算机中安装了PyGreSQL,Xcode和Xcode工具,并且还将PostgreSQL的bin目录添加到$ PATH。

I already had PyGreSQL, Xcode and Xcode tools installed in my machine, and I also added the bin directory of PostgreSQL to $PATH.

推荐答案

我能够通过编辑模块的 setup.py

I was able to compile the module by editing the modules's setup.py

找到该行

extra_compile_args = ....

这是传递给clang的其他编译参数的列表。额外的参数之一将是 -Werror ,这意味着将所有警告视为错误。并且您知道一个错误将终止编译。

It's a list of extra compile arguments to pass to clang. One of the extra arguments will be -Werror, which means "treat all warnings as ERRORS". And as you know an error will abort compilation.

删除该行,然后再次运行 python3 setup.py build 并且您会看到出现同一行,但这一次是警告,一切都没问题!

Remove that line, and run python3 setup.py build again and you'll see the same line appears, but this time as a warning, and everything goes okay!

这篇关于在Mac OS下安装pygresql时出现clang错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆