【问题标题】:I can't deploy to heroku with django我无法使用 django 部署到 heroku
【发布时间】:2018-05-09 11:38:25
【问题描述】:

我想部署到 Heroku。但是会显示错误消息。

$ git push heroku master

这会生成以下错误输出:

remote:            Error: could not determine PostgreSQL version from '10.3'
remote:            
remote:            ----------------------------------------
remote:        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-7sfvmk3a/psycopg2/
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to ayblog.
remote: 
To https://git.heroku.com/ayblog.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/ayblog.git'

我认为“错误:无法从 '10.3' 确定 PostgreSQL 版本”是错误的。

我的事情“命令“python setup.py egg_info”失败,错误代码1在/tmp/pip-build-7sfvmk3a/psycopg2/”也是错误的。

怎么做?

【问题讨论】:

  • 你安装了pip install psycopg2吗?您的requirements.txt 文件中还有psycopg2 库的记录吗?
  • 非常感谢您的回复。我在 requirements.txt 中安装了 psycopg2。我想知道如何指定 psycopg2 版本。

标签: python django heroku


【解决方案1】:

我做了一个快速的谷歌搜索,发现有一篇博文建议你做两件事(逐字复制):

将 psycopg2 的要求更改为等于或大于 2.6.1

取消固定 psycopg2

来源:https://oshanebailey.jamaicandevelopers.com/python/error-could-not-determine-postgresql-version-10-0/

【讨论】:

  • 我无法安装psycopg2 2.6.1。因为我无法指定它的版本。 pip install psycopg2==2.6.1 生成以下错误输出。 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'. ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-x8n9bxw4/psycopg2/
  • 如果你在你的 requirements.txt 中安装 psycopg2 没有指定,它不应该安装最新的稳定版本吗?
  • 如果找不到二进制文件,也许您没有正确安装 postgresql?您可能需要安装 libpq (stackoverflow.com/questions/11618898/…)
猜你喜欢
  • 1970-01-01
  • 2017-12-09
  • 2021-09-07
  • 2020-07-11
  • 1970-01-01
  • 2016-10-19
  • 1970-01-01
  • 2013-07-16
相关资源
最近更新 更多