AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1063607
Accepted
user977828
user977828
Asked: 2021-05-15 15:14:15 +0800 CST2021-05-15 15:14:15 +0800 CST 2021-05-15 15:14:15 +0800 CST

错误:无法从“11.7”确定 PostgreSQL 版本

  • 772

我找到了一个 Django 项目,但未能通过以下方式在 Docker 容器中运行:

  1. git clone https://github.com/hotdogee/django-blast.git

我有以下 Dockerfile:

FROM python:2
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/

因为docker-compose.yml我使用:

version: "3"

services:
  db:
    image: postgres
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
  web:
    build: .
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    depends_on:
      - db

接下来,我遇到了这个错误:

$ docker-compose build
...
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Gq_JSR/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Gq_JSR/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info
         cwd: /tmp/pip-install-Gq_JSR/psycopg2/
    Complete output (7 lines):
    running egg_info
    creating /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info
    writing /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
    writing dependency_links to /tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing manifest file '/tmp/pip-install-Gq_JSR/psycopg2/pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    Error: could not determine PostgreSQL version from '11.7'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.0.2; however, version 20.3.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

我错过了什么?

先感谢您

django python postgresql docker-compose
  • 1 1 个回答
  • 1767 Views

1 个回答

  • Voted
  1. Best Answer
    mforsetti
    2021-05-15T23:23:06+08:002021-05-15T23:23:06+08:00

    错误:无法从“11.7”确定 PostgreSQL 版本

    的已知错误。psycopg2<=2.6.2尝试通过编辑它requirements.txt并更改psycopg2==2.6.0为psycopg2==2.7.

    • 6

相关问题

  • Apache Django Mod_Wsgi - 自动重新加载应用程序

  • 哪个 Apache 包最适合 mod_wsgi Django 应用程序?

  • 设置 Django 服务器以服务多个站点的最佳方式是什么?

  • 哪个最适合 Django?Lighttpd 还是 Nginx?或者也许是别的什么?[关闭]

  • 如何向运行共享 IIS 服务器的 Python 新手解释 Django/Python 安装 [关闭]

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve