【问题标题】:ERROR: No matching distribution found for psycopg2==2.7.3.2错误:找不到 psycopg2==2.7.3.2 的匹配分布
【发布时间】:2021-10-19 04:32:40
【问题描述】:

我正在使用这个命令运行 python 容器

docker run -p 8888:8888 --name jupyter_notebook -v  /home/Data/jupyter_project/:/home/jovyan/work/jupyter_project jupyter/scipy-notebook . 

当我尝试在项目上安装我的文件 requirements.txt 时,出现以下错误。

请谁能帮我解决这个问题。

ERROR: Command errored out with exit status 1:
     command: /opt/conda/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gei1w7ax/psycopg2_395c58e14f844125b95c77ccccec309d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gei1w7ax/psycopg2_395c58e14f844125b95c77ccccec309d/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-bkenr2u2
         cwd: /tmp/pip-install-gei1w7ax/psycopg2_395c58e14f844125b95c77ccccec309d/
    Complete output (14 lines):
    running egg_info
    creating /tmp/pip-pip-egg-info-bkenr2u2/psycopg2.egg-info
    writing /tmp/pip-pip-egg-info-bkenr2u2/psycopg2.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-bkenr2u2/psycopg2.egg-info/dependency_links.txt
    writing top-level names to /tmp/pip-pip-egg-info-bkenr2u2/psycopg2.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-bkenr2u2/psycopg2.egg-info/SOURCES.txt'
    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'.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/dd/47/000b405d73ca22980684fd7bd3318690cc03cfa3b2ae1c5b7fff8050b28a/psycopg2-2.7.3.2.tar.gz#sha256=5c3213be557d0468f9df8fe2487eaf2990d9799202c5ff5cb8d394d09fad9b2a (from https://pypi.org/simple/psycopg2/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement psycopg2==2.7.3.2 (from versions: 2.0.10, 2.0.11, 2.0.12, 2.0.13, 2.0.14, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.4, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.6, 2.6.1, 2.6.2, 2.7, 2.7.1, 2.7.2, 2.7.3, 2.7.3.1, 2.7.3.2, 2.7.4, 2.7.5, 2.7.6, 2.7.6.1, 2.7.7, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9, 2.9.1)
ERROR: No matching distribution found for psycopg2==2.7.3.2
Note: you may need to restart the kernel to use updated packages.

编辑


WARNING: Discarding https://files.pythonhosted.org/packages/19/79/35c7596bab4456f3610c12ec542a94d51c6781ced587d1d85127210b879b/psycopg2-2.0.10.tar.gz#sha256=e40cc04b43849085725076ae134bfef9e3b087f6dd7c964aeeb930e2f0bc14ab (from https://pypi.org/simple/psycopg2/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement psycopg2 (from versions: 2.0.10, 2.0.11, 2.0.12, 2.0.13, 2.0.14, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.4, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.6, 2.6.1, 2.6.2, 2.7, 2.7.1, 2.7.2, 2.7.3, 2.7.3.1, 2.7.3.2, 2.7.4, 2.7.5, 2.7.6, 2.7.6.1, 2.7.7, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9, 2.9.1)
ERROR: No matching distribution found for psycopg2

Note: you may need to restart the kernel to use updated packages.```


Grateful

【问题讨论】:

  • 它告诉你 2.7.3.2 不是 psycopg2 的有效版本 - 输出中列出了有效版本。您的 requirements.txt 文件有错字或已过期。
  • 我认为,如果你在 requirements.txt 中碰到最新版本的 psycopg2 会更好
  • 这是我的 requirements.txt 的内容 SQLAlchemy==1.2.2 pandas==0.25.0 docker==3.3.0 python-json-logger sshtunnel==0.1.4 jupyter jupytext== 0.8.4 matplotlib seaborn psycopg2==2.7.3.2
  • @Tethys0 请问我该怎么办?
  • @Tethys0 我会尝试 psycopg2 的 2.9.1 并告诉你。丹克

标签: python requirements.txt


【解决方案1】:

在与 docker 一起使用时尝试安装此软件包而不是 psycopg2。

pip install psycopg2-binary

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-19
    • 1970-01-01
    • 2022-11-06
    • 1970-01-01
    • 2020-06-13
    • 1970-01-01
    • 2017-05-05
    • 1970-01-01
    相关资源
    最近更新 更多