Ubuntu 20.04 upgrade, Python missing libffi.so.6

后端 未结 6 1533
暗喜
暗喜 2021-02-06 20:59

I recently upgraded my OS to Ubuntu 20.04 LTS.

Now when I try to import a library like Numpy in Python, I get the following error:

ImportError: libffi.so.6         


        
6条回答
  •  不知归路
    2021-02-06 21:53

    It seems like I fixed it. I could be wrong, but here is what I think happened:

    1. Ubuntu 20.04 upgraded libffi6 to libffi7
    2. Python is still looking for libffi6

    What I did to fix it :

    Locate libffi.so.7 in your system

    $ find /usr/lib -name "libffi.so*"
    

    Create a simlink named libffi.so.6 that points to libffi.so.7:

    sudo ln -s /usr/path/to/libffi.so.7 /usr/lib/path/to/libffi.so.6
    

    UPDATE:

    As noted by many users, this fix could have unintended consequences. The better way to do it is to reinstall python as @amichaud explained. This should be used as a last resort IF you're not using pyenv/virtualenv/etc in which case removing python will cause a lot of dependencies to be removed as well.

提交回复
热议问题