python - 在 Amazon Linux 上安装 psycopg2 时出错

标签 python linux postgresql python-3.x emr

当使用以下命令在 Amazon Linux 上安装 psycopg2 时:sudo pip-3.4 install psycopg2 我得到以下输出:

gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.7 (dt dec pq3 ext)" -DPG_VERSION_NUM=90218 -I/usr/include/python3.4m -I. -I/usr/include/pgsql92 -I/usr/include/pgsql92/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.4/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    In file included from ./psycopg/replication_cursor.h:30:0,
                     from psycopg/psycopgmodule.c:32:
    ./psycopg/libpq_support.h:31:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘XLogRecPtr’
     typedef unsigned PG_INT64_TYPE XLogRecPtr;
                                    ^
    In file included from psycopg/psycopgmodule.c:32:0:
    ./psycopg/replication_cursor.h:47:5: error: unknown type name ‘XLogRecPtr’
         XLogRecPtr  write_lsn;        /* LSNs for replication feedback messages */
         ^
    ./psycopg/replication_cursor.h:48:5: error: unknown type name ‘XLogRecPtr’
         XLogRecPtr  flush_lsn;
         ^
    ./psycopg/replication_cursor.h:49:5: error: unknown type name ‘XLogRecPtr’
         XLogRecPtr  apply_lsn;
         ^
    In file included from psycopg/psycopgmodule.c:33:0:
    ./psycopg/replication_message.h:46:5: error: unknown type name ‘XLogRecPtr’
         XLogRecPtr  data_start;
         ^
    ./psycopg/replication_message.h:47:5: error: unknown type name ‘XLogRecPtr’
         XLogRecPtr  wal_end;
         ^
    error: command 'gcc' failed with exit status 1

我已经安装了 gccpostgresql-develpostgresql-libspython34-devel。我是否缺少包裹或设置?

编辑:这是在 EMR 节点上。

最佳答案

我和EMR有同样的问题,我在下面试过

sudo yum -y install gcc python-setuptools python-devel postgresql-devel
sudo /usr/bin/pip install --upgrade pip 
sudo /usr/local/bin/pip install psycopg2

当我在 EMR 上运行它时它可以工作,但当 EMR 从 Pipeline 启动时它不起作用。

关于python - 在 Amazon Linux 上安装 psycopg2 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42658406/

相关文章:

python - ScrapingHub:没有名为 Mysql.connector 的模块

linux - couchdb 已死,但 pid 文件存在

postgresql - 可成像类型未设置多态关联

ruby-on-rails - 显示关联记录索引 View

postgresql - 选择带有别名表的不同列在 postgres 中不起作用

python - 具有自定义指标的 DBSCAN

python - 如何在Python中设置一个计时器来验证用户名?

linux - 免费 BSD : What is a global flag

linux - 放入 shell 脚本时 [SED] 的奇怪行为

python manage.py syncdb错误