1

我正在測試AWS以啓動Web服務。 我堅持使用pg_config。錯誤日誌是AWS ElasticBeanst amazon linux pg_config錯誤與psycopg2

/app/requirements.txt (line 1)) 
Using cached psycopg2-2.6.2.tar.gz 
    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 dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt 
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.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'. 

在stackoverflow中有很多解決方案,但它不適用於我。

packages: 
    yum: 
    python-devel: [] 
    postgresql95-devel: [] 
    libjpeg-devel: '6b' 

container_commands: 
    01_migrate: 
    command: "python manage.py migrate" 
    02_collectstatic: 
    command: "python manage.py collectstatic --noinput" 
    03_createsu: 
    command: "python manage.py createsu" 
    leader_only: true 

option_settings: 
    "aws:elasticbeanstalk:application:environment": 
    DJANGO_SETTINGS_MODULE: "onreview.settings" 
    PYTHONPATH: "$PYTHONPATH" 
    "aws:elasticbeanstalk:container:python": 
    WSGIPath: "onreview/wsgi.py" 

這是我的.ebextensions/python.config文件內容。我通過壓縮我的源代碼來上傳。

我將postgresql95-devel改爲postgresql-devel,93,94,全部都是這樣。我現在使用9.5版本的db。

我認爲--pg-config的路徑是問題。但我無法改變它。

有沒有解決方法?

p.s我不想通過SSH或其他設置在EC2實例內部。

+0

目前,這是一個postgresql版本的問題。 我使用降級版本解決了問題。不是9.5而是9.4 在這個時候,我認爲這是固定的。 – 101110101100111111101101

回答

1

您在原始文章中有語法錯誤,packages:不應縮進。我不知道爲什麼當python包含在安裝中時你有python-devel,所以我不能說它不會干擾。同樣用線設置python路徑。

packages: 
    yum: 
    python-devel: [] 
    postgresql95-devel: [] 
    libjpeg-devel: '6b' 

container_commands: 
    01_migrate: 
    command: "python manage.py migrate" 
    02_collectstatic: 
    command: "python manage.py collectstatic --noinput" 
    03_createsu: 
    command: "python manage.py createsu" 
    leader_only: true 

option_settings: 
    aws:elasticbeanstalk:application:environment: 
    DJANGO_SETTINGS_MODULE: "onreview.settings" 
    PYTHONPATH: "$PYTHONPATH" 
    aws:elasticbeanstalk:container:python: 
    WSGIPath: "onreview/wsgi.py"