我应该如何使用 pip install psycopg2==2.7.* 修复错误?

Mar*_*cki 1 django heroku

我正在尝试将我使用 heroku 创建的应用程序放在服务器 www 上。但是当我在 Ubuntu 上的终端上输入 pip install psycopg2==2.7.* 时,出现以下错误:

ERROR: Command errored out with exit status 1:
     command: /home/marcin/Python/learning_log/ll_env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-c67buptz/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-c67buptz/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-c67buptz/psycopg2/pip-egg-info
         cwd: /tmp/pip-install-c67buptz/psycopg2/
    Complete output (28 lines):
    running egg_info
    creating /tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info
    writing /tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing top-level names to /tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
    writing manifest file '/tmp/pip-install-c67buptz/psycopg2/pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    /home/marcin/Python/learning_log/ll_env/lib/python3.8/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
      warnings.warn(msg, warning_class)
    /home/marcin/Python/learning_log/ll_env/lib/python3.8/site-packages/setuptools/command/egg_info.py:643: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.
    Please extend command classes from setuptools instead of distutils.
      warnings.warn(
    
    Error: pg_config executable not found.
    
    pg_config is required to build psycopg2 from source.  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'.
    
    If you prefer to avoid building psycopg2 from source, please install the PyPI
    'psycopg2-binary' package instead.
    
    For further information please check the 'doc/src/install.rst' file (also at
    <http://initd.org/psycopg/docs/install.html>).
    
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Run Code Online (Sandbox Code Playgroud)

我应该怎么办?

Gun*_*una 6

您需要一些依赖项检查此答案 /sf/answers/3281415511/

sudo apt install libpq-dev python3-dev
Run Code Online (Sandbox Code Playgroud)