首页 > 解决方案 > ImportError: libffi.so.6: cannot open shared object file: No such file or directory

问题描述

The linux server is not connected to the network. I need use the serve to train my deep learning model. So, I installed Anaconda to manage the environment. I have created a empty environment Example. I have installed offline Python 3.6.7 into Example (The Linux server had Python 3.8.8). My problem is: when I use "python setup.py install" to install setuptool in “setuptools-57.0.0" folder,an error occurred: ImportError: libffi.so.6: cannot open shared object file: No such file or directory

So, what should I do? Do I need to updata Python? What should I do without upgrading Python? Thank you very much!

标签: pythonpython-3.xlinuxanacondaimporterror

解决方案


更新 conda 后我遇到了同样的错误。conda 不会安装软件包:

(myEnv) $ conda install requests
Traceback (most recent call last):
   File "/home/me/miniconda2/bin/conda", line 13, in <module>
...
ImportError: libffi.so.6: cannot open shared object file: No such file or directory

我在 miniconda 的包中找到了 libffi.so.6 并创建了一个符号链接:

cd ~/miniconda2/lib
# this would list all libffi and no libffi.so.6 there
ls -lsah libffi*
# there might be different libffi versions, you can delete a link if not working
# I had libffi.so.6 in this folder
ls ../pkgs/libffi-3.3-he6710b0_2/lib/
# created a symlink
ln -s ../pkgs/libffi-3.3-he6710b0_2/lib/libffi.so.6 libffi.so.6
# or you could try creating symlink from libffi.so.7.1.0, both libffi.so.7 and libffi.so.6 were symlinks to it
ln -s ../pkgs/libffi-3.3-he6710b0_2/lib/libffi.so.7.1.0 libffi.so.6

现在~/miniconda2/lib已经libffi.so.6安装成功。

如果有你可以尝试创建符号链接libffi.so.7.1.0~/miniconda2/lib我没有。


推荐阅读