Ubuntu 22.04 | libssl.so.1.1: 无法打开共享对象文件:没有那个文件或目录

Ubuntu 22.04 | libssl.so.1.1: cannot open shared object file: No such file or directory

我刚刚更新到 Ubuntu 22.04 LTS,我使用 OpenSSL 的库刚刚停止工作。 看起来 Ubuntu 切换到了 OpenSSL 的 3.0 版本。

例如,诗歌停止工作:

Traceback (most recent call last):
  File "/home/robz/.local/bin/poetry", line 5, in <module>
    from poetry.console import main
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/application.py", line 7, in <module>
    from .commands.about import AboutCommand
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/commands/__init__.py", line 4, in <module>
    from .check import CheckCommand
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/commands/check.py", line 2, in <module>
    from poetry.factory import Factory
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/factory.py", line 18, in <module>
    from .repositories.pypi_repository import PyPiRepository
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/repositories/pypi_repository.py", line 33, in <module>
    from ..inspection.info import PackageInfo
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/inspection/info.py", line 25, in <module>
    from poetry.utils.env import EnvCommandError
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py", line 23, in <module>
    import virtualenv
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/__init__.py", line 3, in <module>
    from .run import cli_run, session_via_cli
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/run/__init__.py", line 11, in <module>
    from ..seed.wheels.periodic_update import manual_upgrade
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/seed/wheels/__init__.py", line 3, in <module>
    from .acquire import get_wheel, pip_wheel_env_run
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/seed/wheels/acquire.py", line 12, in <module>
    from .bundle import from_bundle
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/seed/wheels/bundle.py", line 4, in <module>
    from .periodic_update import periodic_update
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/seed/wheels/periodic_update.py", line 10, in <module>
    import ssl
  File "/home/robz/.pyenv/versions/3.9.10/lib/python3.9/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: libssl.so.1.1: cannot open shared object file: No such file or directory

有简单的解决方法吗?例如,无需卸载 OpenSSL 3 即可使用 libssl.so.1.1(我不知道这是否可能)。

好吧,幸运的是我正在使用 pyenv 来管理我系统上的 python 个版本。 我之前使用的是 python 3.9.10,并且在 ubuntu 22.04.

上有一个 ssl 错误

我刚刚删除了 Python 3.9.10 并安装了 3.9.12,使其成为全局版本,它解决了我的问题。

pyenv uninstall 3.9.10
pyenv install 3.9.12
pyenv global 3.9.12

curl -sSL https://install.python-poetry.org | python3 -

正如@larsks 所建议的,只需 re-installing 环境就足够了(甚至不需要升级 Python 版本)。重新安装环境将使用当前安装的系统库。

我在 nvm 环境中使用 nodejs 时遇到了同样的问题。 我没有为 ubuntu jammy 找到任何带有 libopenssl1.1 的 deb 包,最后到了我手动安装它的地步:

wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
cd openssl-1.1.1o
./config
make
make test
sudo make install