【问题标题】:Building image on a docker container for running own Django app在 docker 容器上构建映像以运行自己的 Django 应用程序
【发布时间】:2017-03-01 19:50:33
【问题描述】:

我正在尝试使用自己的现有 Django 应用程序构建一个在 Docker 容器中运行的映像,执行以下命令

    sudo docker build -t avilaholding/clubmercado ~/Documents/docker/cmimage

但是我用 psycopg2 得到了这个错误

Collecting pathspec==0.3.4 (from -r /srv/clubmercado/requirements.txt (line 23))
  Downloading pathspec-0.3.4.tar.gz
Collecting psycopg2==2.6.1 (from -r /srv/clubmercado/requirements.txt (line 24))
  Downloading psycopg2-2.6.1.tar.gz (371kB)
    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'.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5wxAAo/psycopg2/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install -r $DOCKYARD_SRVPROJ/requirements.txt' returned a non-zero code: 1

我认为这可能是因为它在 python 2.7 上运行,但我希望它在 python 3.5 上运行。我在 Ubuntu 16.04 上安装了这两个版本。

另外,当我执行 pip --version 或者 pip3 --version

会说安装的版本已经是9.0.1了。

【问题讨论】:

    标签: python django docker


    【解决方案1】:

    我遇到了同样的问题。我修复了它运行

    sudo apt-get install python-dev libpq-dev
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-06
      • 2021-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-04
      • 1970-01-01
      相关资源
      最近更新 更多