无法在Centos上安装PyGreSql [英] Unable to install PyGreSql on Centos

查看:147
本文介绍了无法在Centos上安装PyGreSql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行以下操作以在Centos上安装PyGreSql:

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

sudo pip3 install pygresql

但是出现以下错误:

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.

推荐答案

这是我在CentOS 7上安装Python 3.6,Pip和PyGreSQL 5.0.6的方法:

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.

在任何情况下,都必须先安装Postgres和Python的开发软件包,然后才能编译PyGreSQL.

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

这篇关于无法在Centos上安装PyGreSql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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