在Heroku上使用Python入门 - 找不到pg_config可执行文件

5

我一直在按照文档操作,直到安装requirements.txt文件这一步。但是在尝试安装第六行"psycopg2==2.5.3"时总是失败了。以下是错误信息 -

Downloading/unpacking psycopg2==2.5.3 (from -r requirements.txt (line 6))
Downloading psycopg2-2.5.3.tar.gz (690kB): 690kB downloaded
Running setup.py (path:/Users/pimpc/Sites/python/herokudemo/python-getting-started/venv/build/psycopg2/setup.py) egg_info for package psycopg2

Error: pg_config executable not found.

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

creating pip-egg-info/psycopg2.egg-info

writing pip-egg-info/psycopg2.egg-info/PKG-INFO

writing top-level names to
pip-egg-info/psycopg2.egg-info/top_level.txt

writing dependency_links to
pip-egg-info/psycopg2.egg-info/dependency_links.txt

writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found



Error: pg_config executable not found.



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'.

当然,我在这里发现了一些帖子。 所以我开始检查事情。 我相信Mac的postgres app附带了psycopg2。 我已经将postgres添加到我的路径中,并在终端中运行“echo $ PATH”进行了检查。 我没有任何其他旧版本的冲突。 而且postgres文档说我应该像这样将其添加到路径中 -

export PATH =“/ Applications / Postgres.app / Contents / Versions / 9.3 / bin:$ PATH:$ PATH”

我已经重新启动了postgres应用程序,停用并重新启动了虚拟环境,但无论如何我都会收到相同的错误。
我可能忽略了什么! 我已经阅读并阅读了其他帖子,甚至涵盖此问题的博客。

1
https://dev59.com/R2gu5IYBdhLWcg3wDS4G - Raja Simon
当您取消激活和重新激活虚拟环境时,您的 PATH 将被重置。因此,请在激活虚拟环境时编写导出语句。 - Burhan Khalid
1个回答

2

在阅读了许多人在Postgres Mac应用程序中遇到的相同错误后,我决定通过Brew安装Postgres,现在一切都正常工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接