Flask App Postgres依赖项

时间:2015-02-24 16:57:12

标签: python postgresql flask psycopg2

我有一个用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

我已经四处搜索了,我所读过的解决方案都没有奏效。任何建议都是rad!

1 个答案:

答案 0 :(得分:0)

安装libpq-dev软件包。