heroku 我应该如何修复pip安装psycopg2==2.7.* 的错误?

jjjwad0x  于 2022-11-24  发布在  其他
关注(0)|答案(2)|浏览(113)

我试图把我的应用程序,我创建的服务器www使用heroku.但当我把我的终端上Ubuntu pip安装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.

我该怎么办?

s71maibg

s71maibg1#

您需要一些依赖项检查此答案https://stackoverflow.com/a/46877364/15208727

sudo apt install libpq-dev python3-dev
ee7vknir

ee7vknir2#

您应该安装pscopg 2-binary和推送到heroku
pip install psycopg2-binarypipenv install psycopg2-binary,具体取决于您的虚拟环境

相关问题