【问题标题】:Flask App Postgres DependenciesFlask 应用程序 Postgres 依赖项
【发布时间】:2015-04-26 10:13:30
【问题描述】:

我有一个用 Flask 编写的网络应用程序。我正在尝试设置我的应用程序,以便它可以轻松下载所需的所有库依赖项。我按照guide here 来构建我的应用程序,如下所示:

MyApp/
  runserver.py
  setup.py
  MyApp/
    templates/
    static/
    __init__.py
    views.py
    x.py
    y.py
    z.py

我的 setup.py 文件如下所示:

from setuptools import setup, find_packages

setup(
  name='MyApp',
  version='1.0',
  packages=find_packages(),
  include_package_data=True,
  zip_safe=False,
  install_requires=[
    'flask',
    'flask-bootstrap',
    'flask-moment',
    'flask-wtf',
    'flask-script',
    'wtforms',
    'psycopg2']
  )

然后我像这样运行设置文件:

python setup.py install

它开始做它的事情,但它总是在安装 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'.
error: Setup script exited with 1

我四处搜索,但我读到的所有解决方案都没有奏效。任何建议都会很受欢迎!

【问题讨论】:

  • 你需要在系统上安装 Postgres。这是 Python 之外的依赖项。

标签: python postgresql flask psycopg2


【解决方案1】:

安装 libpq-dev 包。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-05
    • 2018-03-26
    • 2014-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多