python系列:报错问题解决:ImportError: libffi.so.6: cannot open shared object file: No such file or directory

本文讲述了在使用Python的深度学习框架如TensorFlow和PyTorch时遇到的ImportError:libffi.so.6错误,介绍了在CentOS和Ubuntu系统上安装libffi以及处理类似问题的方法,包括搜索对应版本、设置环境变量和安装依赖包。
摘要由CSDN通过智能技术生成




前言

一 .报错问题解决:ImportError: libffi.so.6: cannot open shared object file: No such file or directory亲测有效,其余仅供参考

一 .报错问题解决:ImportError: libffi.so.6: cannot open shared object file: No such file or directory

然后按照
python系列(不具有任何参考性):— no python application found, check your startup logs for errors
四. BUG之路2--ubuntu安装uwsgi测试报错:failed to open python file test.pyuwsgi卸载了,准备pip3 install uwsgi

报错

ImportError: libffi.so.6: cannot open shared object file: No such file or directory

教程

我在centos7/openSUSE服务器上运行pytorch或tensorflow时出现这个问题。
环境:3080Ti 2080Ti CUDA 11.5
网上找到的方案集中在这里:
Ubuntu 20.04 upgrade, Python missing libffi.so.6 - Stack Overflow
但可惜都不管用。

解决方法:

既然没有,就装呗。直接搜就行。

centos:

在这里插入图片描述

Libffi6 Download (DEB, EOPKG, RPM) (pkgs.org)
找到对应系统版本,进入该页面:

libffi6-3.2.1-alt3.x86_64.rpm ALT Linux P9 Download (pkgs.org)

wget到本地后
rpm -ivh +包名 安装即可
然后程序成功运行。

找到对应版本:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

下载、安装即可。
---------------------------------------------------------------- 2022/11/4更新----------------------------------------------------------------
接上文,下载的文件是 libffi6-3.2.1-lp152.3.1.x86_64.rpm , 进入该文件路径,安装 :sudo rpm -ivh libffi6-3.2.1-lp152.3.1.x86_64.rpm ,问题解决。
确实libffi.so.7的应该也可这样解决。。

实际上

dpkg -i libffi6_3.2.1-9_amd64.deb

成功了

二. ImportError: libffi.so.6: cannot open shared object file: No such file or directory

有一次make里遇到这样一个问题:

ImportError: libffi.so.6: cannot open shared object file: No such file or directory

提示就是libffi.so.6不存在的意思,先用find命令找到libffi.so.6的目录,再把该路径加到环境变量LD_LIBRARY_PATH中。

ImportError: libffi.so.6: cannot open shared object file: No such file or directory

ImportError: libffi.so.6: cannot open shared object file: No such file or directory

三. ImportError: libffi.so.6: cannot open shared object file: No such file or directory

通常的,很简单,这个提示已经告诉libffi.so.6不存在

这事通常你已经装了,libffi

解决方法:在环境变量,或者configure参数中,指定几个文件夹

你安装的如果是通过make,应该通过 ./configure --help,查看,应该增加什么 --with-=//**

如果是通过python setup.py,通常是添加 下面,路径应该要自己修改下,再,python setup.py install 安装

root_path=/root/
prefix_path=$root_path
export PKG_CONFIG_PATH=$prefix_path/lib/pkgconfig:$prefix_path/lib/
export LD_LIBRARY_PATH=$prefix_path/lib/







chauncylee

报错问题解决:ImportError: libffi.so.6: cannot open shared object file: No such file or directory

drkuan

ImportError: libffi.so.6: cannot open shared object file: No such file or directory

KgdYsg

ImportError: libffi.so.6: cannot open shared object file: No such file or directory

  • 11
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坦笑&&life

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值