在Mac OS下安装PygreSQL时的叮当错误[英] clang error when installing pygresql under Mac OS

本文是小编为大家收集整理的关于在Mac OS下安装PygreSQL时的叮当错误的处理方法,想解了在Mac OS下安装PygreSQL时的叮当错误的问题怎么解决?在Mac OS下安装PygreSQL时的叮当错误问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我试图在Mac OS X(10.11.3)下安装Pygresql,但是从PIP和源安装时发生了相同的clang错误.

$ 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

时发生clang错误

我已经在计算机中安装了pygresql,Xcode和Xcode工具,我还将PostgreSQL的BIN目录添加到$ PATH中.

推荐答案

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

来编译模块

找到行

extra_compile_args = ....

这是传递给clang的额外编译参数的列表.额外的论点之一将是 -Werror ,这意味着"将所有警告视为错误".众所周知,错误将中止汇编.

删除该行,然后再次运行python3 setup.py build,您会看到同一行出现,但是这次是一个警告,一切正常!

本文地址:https://www.itbaoku.cn/post/1764124.html