Unable to install PyGreSql on Centos

大憨熊 提交于 2019-12-13 18:13:14

问题


I'm doing the following to install PyGreSql on Centos:

sudo pip3 install pygresql

But I get the following error:

Collecting PyGreSQL
  Using cached https://files.pythonhosted.org/packages/4a/65/03b1cd9b6daaa4e32ee72dd5fb1a01fbb7cd0dfe5439e34af6caa6ec60dc/PyGreSQL-5.0.6.tar.gz
Building wheels for collected packages: PyGreSQL
  Running setup.py bdist_wheel for PyGreSQL
  Complete output from command /usr/local/bin/python3.5 -c "import setuptools;__file__='/tmp/pip-build-scnuzepv/PyGreSQL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp0zf45j54pip-wheel-:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  copying pg.py -> build/lib.linux-x86_64-3.5
  copying pgdb.py -> build/lib.linux-x86_64-3.5
  running build_ext
  building '_pg' extension
  creating build/temp.linux-x86_64-3.5
  gcc -pthread -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYGRESQL_VERSION=5.0.6 -DDIRECT_ACCESS -DLARGE_OBJECTS -DDEFAULT_VARS -DESCAPING_FUNCS -I/usr/local/include/python3.5m -I/usr/include -I/usr/local/include/python3.5m -c pgmodule.c -o build/temp.linux-x86_64-3.5/pgmodule.o -O2 -funsigned-char -Wall -Werror
  cc1: warnings being treated as errors
  pgmodule.c: In function ‘get_type’:
  pgmodule.c:261: error: will never be executed
  pgmodule.c: In function ‘connGetCastHook’:
  pgmodule.c:3261: error: will never be executed
  pgmodule.c: In function ‘connGetNoticeReceiver’:
  pgmodule.c:3307: error: will never be executed
  pgmodule.c: In function ‘pgGetJsondecode’:
  pgmodule.c:5428: error: will never be executed
  pgmodule.c: In function ‘connInsertTable’:
  pgmodule.c:2618: error: will never be executed
  pgmodule.c:2593: error: will never be executed
  pgmodule.c: In function ‘connQuery’:
  pgmodule.c:2242: error: will never be executed
  pgmodule.c: In function ‘get_col_types’:
  pgmodule.c:371: error: will never be executed
  pgmodule.c: In function ‘cast_sized_simple’:
  pgmodule.c:497: error: will never be executed
  pgmodule.c:476: error: will never be executed
  pgmodule.c:484: error: will never be executed
  pgmodule.c: In function ‘cast_unsized_simple’:
  pgmodule.c:576: error: will never be executed
  pgmodule.c: In function ‘cast_array’:
  pgmodule.c:649: error: will never be executed
  pgmodule.c:3525: error: will never be executed
  pgmodule.c:3492: error: will never be executed
  pgmodule.c: In function ‘sourcePutData’:
  pgmodule.c:4007: error: will never be executed
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for PyGreSQL

Can anyone tell me how to fix this? I have search a lot on the internet but not found a solution that works for me.


回答1:


Here is how I install Python 3.6, Pip and PyGreSQL 5.0.6 on CentOS 7:

yum install epel-release 
yum install python36 python36-devel postgresql-libs postgresql-devel
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python36 get-pip.py
pip3 install pygresql

These commands run smoothly without any errors for me.

In any case it's necessary that you have the devel-packages for Postgres and Python installed before you can compile PyGreSQL.



来源:https://stackoverflow.com/questions/53750450/unable-to-install-pygresql-on-centos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!