繁体   English   中英

Amazon Elastic Beanstalk 上的 Psycopg2

[英]Psycopg2 on Amazon Elastic Beanstalk

我正在尝试上传我的项目(在 python 中),该项目将 Psycopg2 用于 Amazon Elastic Beanstalk。 我正在使用包含我的项目和 requirements.txt 文件的 zip 文件执行此操作。

但我收到此错误:

下载/解包 psycopg2>=2.4.6(来自 -r /opt/python/ondeck/app/requirements.txt(第 3 行))为包 psycopg2 运行 setup.py egg_info 错误:找不到 pg_config 可执行文件。

 Please add the directory containing pg_config to the PATH or specify the full executable path with the option: python setup.py build_ext --pg-config /path/to/pg_config build ... or with the pg_config option in 'setup.cfg'. Complete output from command python setup.py egg_info: running egg_info

我如何在亚马逊上解决这个问题?

在您的容器中需要 postgresql-devel。 创建一个包含以下内容的文件“.ebextensions/packages.config”:

packages:
  yum:
    postgresql94-devel: []

postgresql94-devel 94替换为您需要的任何版本的 postgres。 例如,用于 postgres 9.3 的postgresql93-devel

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-packages

试图对接受的答案发表评论,但没有这样做的声誉。 最近来自 AWS 支持的论坛帖子表明包名称是“postgresql93-devel”。 postgresql-devel 在 2014.09 AMI 中不起作用。

我挣扎了一段时间,无法使上述解决方案起作用。 我也尝试了许多其他解决方案,但最终导致我缺乏基本的理解。

配置文件按字母顺序读取。 因此,如果您有多个(您可能会这样做),请确保“packages.config”按字母顺序排在您的 .config 之前,并带有 container_commands。

否则,例如将在安装软件包之前调用 'syncdb'。

sudo yum install gcc python-setuptools python-devel postgresql-devel
sudo easy_install psycopg2

这在我的 Linux AWS 上运行良好

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM