paramiko.transport:ImportError:libffi-d77877bc.so.6.0.4:无法打开共享对象文件:没有这样的文件或目录

时间:2019-07-06 11:07:42

标签: python apache paramiko libffi

我正在通过apache服务器运行flask应用程序。

我的应用程序正在使用paramiko模块通过SSH连接到另一台服务器。

当我尝试连接时,我的Apache日志中出现此错误

[Sat Jul 06 11:48:22.634074 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:Unknown exception: libffi-d77877bc.so.6.0.4: cannot open shared object file: No such file or directory
[Sat Jul 06 11:48:22.640325 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:Traceback (most recent call last):
[Sat Jul 06 11:48:22.640681 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 1757, in run
[Sat Jul 06 11:48:22.641018 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    self.kex_engine.parse_next(ptype, m)
[Sat Jul 06 11:48:22.641365 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/paramiko/kex_group1.py", line 75, in parse_next
[Sat Jul 06 11:48:22.641691 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    return self._parse_kexdh_reply(m)
[Sat Jul 06 11:48:22.642033 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/paramiko/kex_group1.py", line 111, in _parse_kexdh_reply
[Sat Jul 06 11:48:22.642362 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    self.transport._verify_key(host_key, sig)
[Sat Jul 06 11:48:22.642709 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 1602, in _verify_key
[Sat Jul 06 11:48:22.643027 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    key = self._key_info[self.host_key_type](Message(host_key))
[Sat Jul 06 11:48:22.643330 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/paramiko/rsakey.py", line 58, in __init__
[Sat Jul 06 11:48:22.643617 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    ).public_key(default_backend())
[Sat Jul 06 11:48:22.643941 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/__init__.py", line 71, in default_backend
[Sat Jul 06 11:48:22.644212 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    _default_backend = MultiBackend(_available_backends())
[Sat Jul 06 11:48:22.644481 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/__init__.py", line 33, in _available_backends
[Sat Jul 06 11:48:22.644770 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    entry_point_backends
[Sat Jul 06 11:48:22.645033 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/__init__.py", line 50, in _backend_import_fallback
[Sat Jul 06 11:48:22.645326 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    from cryptography.hazmat.backends.openssl.backend import backend as be_ossl
[Sat Jul 06 11:48:22.645616 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
[Sat Jul 06 11:48:22.645871 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    from cryptography.hazmat.backends.openssl.backend import backend
[Sat Jul 06 11:48:22.646162 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/backend.py", line 17, in <module>
[Sat Jul 06 11:48:22.646457 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    from cryptography import utils, x509
[Sat Jul 06 11:48:22.646714 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/x509/__init__.py", line 7, in <module>
[Sat Jul 06 11:48:22.646983 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    from cryptography.x509.base import (
[Sat Jul 06 11:48:22.647268 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/x509/base.py", line 16, in <module>
[Sat Jul 06 11:48:22.647527 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    from cryptography.x509.extensions import Extension, ExtensionType
[Sat Jul 06 11:48:22.647835 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/x509/extensions.py", line 20, in <module>
[Sat Jul 06 11:48:22.648120 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    from cryptography.hazmat.primitives import constant_time, serialization
[Sat Jul 06 11:48:22.648362 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:  File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/constant_time.py", line 9, in <module>
[Sat Jul 06 11:48:22.648594 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:    from cryptography.hazmat.bindings._constant_time import lib
[Sat Jul 06 11:48:22.648839 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:ImportError: libffi-d77877bc.so.6.0.4: cannot open shared object file: No such file or directory
[Sat Jul 06 11:48:22.649070 2019] [wsgi:error] [pid 81138] ERROR:paramiko.transport:

提及的库位于隐藏的文件夹“ usr / local / lib / python3.5 / dist-packages / .libs_cffi_backend /”中

我已经尝试在使用中设置“ LD_LIBRARY_PATH”:

os.environ['LD_LIBRARY_PATH'] = "/usr/local/lib/python3.5/dist-packages/.libs_cffi_backend/"

我还尝试在/ usr / lib中创建指向它的符号链接

ln -s /usr/local/lib/python3.5/dist-packages/.libs_cffi_backend/ /usr/lib/

,然后运行命令ldconfig。但是我得到这个错误

ldconfig: file /usr/lib/libffi-d77877bc.so.6.0.4 is truncated.

我还使用导出命令设置了“ LD_LIBRARY_PATH”,但无济于事。同样的问题。

这是我使用的代码:

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
    ssh.connect(hostname=ip_addr, username=username, password=password)
except:
    return 0

感谢您,感谢您。

0 个答案:

没有答案