即使我使用 pip 安装 psycopg2 后,我仍然得到 Nomatching distribution found for psycopg2

发布于 2025-01-11 06:47:37 字数 6106 浏览 0 评论 0原文

我已经为此工作了一个多星期了,版本问题似乎无穷无尽。我下载了一个复杂的 Django 应用程序,它有多个安装脚本。这是非常复杂的。

我遇到了一个需要通过删除 Pipfile.lock 来修复的错误,然后我遇到了一些“缺少模块”错误,我手动执行了:

pip3 install importlib_metadata

pip3 install ConfigParser

但现在我尝试:

pipenv lock

我收到绝对无穷无尽的错误消息,其中一小部分看起来像:

ERROR:pip.subprocessor:Command errored out with exit status 1:
 command: /home/ec2-user/.local/share/virtualenvs/blueflow-c7ciKYpf/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pipenv-233zg4_c-build/psycopg2_a87c46885ac64bcd839843d942c021c6/setup.py'"'"'; __file__='"'"'/tmp/pipenv-233zg4_c-build/psycopg2_a87c46885ac64bcd839843d942c021c6/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'"'"'))' --no-user-cfg egg_info --egg-base /tmp/pip-pip-egg-info-t04x5e3y
     cwd: /tmp/pipenv-233zg4_c-build/psycopg2_a87c46885ac64bcd839843d942c021c6/
Complete output (6 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pipenv-233zg4_c-build/psycopg2_a87c46885ac64bcd839843d942c021c6/setup.py", line 225
    except Warning, w:
                  ^
SyntaxError: invalid syntax
----------------------------------------
ERROR:pip.subprocessor:Command errored out with exit status 1:
 command: /home/ec2-user/.local/share/virtualenvs/blueflow-c7ciKYpf/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pipenv-233zg4_c-build/psycopg2_4e8ce76ba6cc49a19dc4f3ec22a582aa/setup.py'"'"'; __file__='"'"'/tmp/pipenv-233zg4_c-build/psycopg2_4e8ce76ba6cc49a19dc4f3ec22a582aa/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'"'"'))' --no-user-cfg egg_info --egg-base /tmp/pip-pip-egg-info-liszsbkl
     cwd: /tmp/pipenv-233zg4_c-build/psycopg2_4e8ce76ba6cc49a19dc4f3ec22a582aa/
Complete output (5 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pipenv-233zg4_c-build/psycopg2_4e8ce76ba6cc49a19dc4f3ec22a582aa/setup.py", line 50, in <module>
    import ConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
CRITICAL:pipenv.patched.notpip._internal.resolution.resolvelib.factory: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, 2.9.2, 2.9.3)
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 743, in _main
[ResolutionFailure]:       resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 711, in resolve_packages
[ResolutionFailure]:       requirements_dir=requirements_dir,
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 693, in resolve
[ResolutionFailure]:       req_dir=requirements_dir
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 1385, in resolve_deps
[ResolutionFailure]:       req_dir=req_dir,
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 1106, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 884, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: No matching distribution found for psycopg2

但是它的核心似乎是:

ERROR: No matching distribution found for psycopg2

我正在尝试弄清楚如何安装它,但我也很好奇是否有人有一些可能有助于解决所有这些错误的元级评论。

我应该补充一点,我可以这样做:

pip3 install psycopg2-binary

这会成功,但是当我这样做时:

pipenv lock

我仍然得到:

ERROR: No matching distribution found for psycopg2

我还看到这一行:

“默认为用户安装,因为正常的站点包不可写”

如果我知道正常的< code>site-packages 是,我会让它可写,但我不知道。

如果我尝试:

 pip3 install psycopg2

我得到:

 Error: pg_config executable not found.

而且:

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, 2.9.2, 2.9.3)
ERROR: No matching distribution found for psycopg2

我不能再花一周的时间在这上面。我想知道是否有某种方法可以突破并让一切正常运转。难道真的没有办法让 Python 做更多的工作来确定需要安装哪些依赖项吗?

I've been working on this over a week now, and the version problems just seem endless. I've downloaded a complex Django app, which has multiple install scripts. It is very complex.

I got an error that needed to be fixed by deleting Pipfile.lock, then I got some "missing module" errors and I manually did:

pip3 install importlib_metadata

pip3 install ConfigParser

but now I try:

pipenv lock

I get absolutely endless error messages, a small part of which looks like:

ERROR:pip.subprocessor:Command errored out with exit status 1:
 command: /home/ec2-user/.local/share/virtualenvs/blueflow-c7ciKYpf/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pipenv-233zg4_c-build/psycopg2_a87c46885ac64bcd839843d942c021c6/setup.py'"'"'; __file__='"'"'/tmp/pipenv-233zg4_c-build/psycopg2_a87c46885ac64bcd839843d942c021c6/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'"'"'))' --no-user-cfg egg_info --egg-base /tmp/pip-pip-egg-info-t04x5e3y
     cwd: /tmp/pipenv-233zg4_c-build/psycopg2_a87c46885ac64bcd839843d942c021c6/
Complete output (6 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pipenv-233zg4_c-build/psycopg2_a87c46885ac64bcd839843d942c021c6/setup.py", line 225
    except Warning, w:
                  ^
SyntaxError: invalid syntax
----------------------------------------
ERROR:pip.subprocessor:Command errored out with exit status 1:
 command: /home/ec2-user/.local/share/virtualenvs/blueflow-c7ciKYpf/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pipenv-233zg4_c-build/psycopg2_4e8ce76ba6cc49a19dc4f3ec22a582aa/setup.py'"'"'; __file__='"'"'/tmp/pipenv-233zg4_c-build/psycopg2_4e8ce76ba6cc49a19dc4f3ec22a582aa/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'"'"'))' --no-user-cfg egg_info --egg-base /tmp/pip-pip-egg-info-liszsbkl
     cwd: /tmp/pipenv-233zg4_c-build/psycopg2_4e8ce76ba6cc49a19dc4f3ec22a582aa/
Complete output (5 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pipenv-233zg4_c-build/psycopg2_4e8ce76ba6cc49a19dc4f3ec22a582aa/setup.py", line 50, in <module>
    import ConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
CRITICAL:pipenv.patched.notpip._internal.resolution.resolvelib.factory: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, 2.9.2, 2.9.3)
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 743, in _main
[ResolutionFailure]:       resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 711, in resolve_packages
[ResolutionFailure]:       requirements_dir=requirements_dir,
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/resolver.py", line 693, in resolve
[ResolutionFailure]:       req_dir=requirements_dir
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 1385, in resolve_deps
[ResolutionFailure]:       req_dir=req_dir,
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 1106, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/usr/local/lib/python3.6/site-packages/pipenv/utils.py", line 884, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: No matching distribution found for psycopg2

but the heart of it seems to be:

ERROR: No matching distribution found for psycopg2

I'm trying to figure out how to install this, but I'm also curious if anyone has some meta level comment that might help resolve all of these errors.

I should add, I can do this:

pip3 install psycopg2-binary

which succeeds, but then when I do this:

pipenv lock

I still get:

ERROR: No matching distribution found for psycopg2

I also see this line:

"Defaulting to user installation because normal site-packages is not writeable"

If I knew where the normal site-packages was, I would make it writeable, but I have no idea.

If I try:

 pip3 install psycopg2

I get:

 Error: pg_config executable not found.

And also:

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, 2.9.2, 2.9.3)
ERROR: No matching distribution found for psycopg2

I cannot afford to spend another week on this. I wonder if there is some way to break through and get everything working. Is there truly no way to get Python to do more of the work of figuring out what dependencies need to be installed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文