【问题标题】:libssl.so.1.1: cannot open shared object file: No such file or directoryUbuntu 22.04 | libssl.so.1.1:无法打开共享对象文件:没有这样的文件或目录
【发布时间】:2022-06-15 22:36:58
【问题描述】:

我刚刚更新到 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(我什至不知道这是否可能)。

【问题讨论】:

  • 我会考虑重新安装您的虚拟环境:ssl 模块需要使用更新的系统库重新构建。
  • 这就是我所做的,就像一个魅力!

标签: python linux openssl python-poetry


【解决方案1】:

我在 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

【讨论】:

  • 我在使用 makemkv 切换到 ubuntu 22.04 时遇到了这个问题。按照描述安装openssl并重新编译makemkv就可以了。虽然我错过了第 2 行之前的tar -xzf openssl-1.1.1o.tar.gz
【解决方案2】:

我解决了:

wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
cd openssl-1.1.1o
./config
make
make test
sudo make install
find / -name libssl.so.1.1
ln -s /usr/local/lib64/libssl.so.1.1  /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libssl.so.1.1  /usr/lib/libssl.so.1.1
find / -name libcrypto.so.1.1
ln -s /home/ubuntu/openssl-1.1.1o/libcrypto.so.1.1    /usr/lib64/libcrypto.so.1.1
ln -s /home/ubuntu/openssl-1.1.1o/libcrypto.so.1.1     /usr/lib/libcrypto.so.1.1

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
【解决方案3】:

好吧,幸运的是,我正在使用 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 建议的那样,只需重新安装环境就足够了(甚至不需要升级 Python 版本)。重新安装环境将使用当前安装的系统库。

【讨论】:

    【解决方案4】:

    这解决了它(22.04 中的打包问题):

    wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb
    
    sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb
    

    【讨论】:

      猜你喜欢
      • 2023-04-02
      • 2022-11-10
      • 2018-10-19
      • 2022-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-12
      • 2018-11-26
      相关资源
      最近更新 更多