ImportError libdynet.so: 无法打开共享对象文件,没有这样的文件或目录

ImportError libdynet.so: cannot open shared object file, No such file or directory

今天我尝试 运行 一个简单的 dynet 程序(我 运行 几个月前没有问题),但出现以下错误:

Traceback (most recent call last):
  File "/home/erelsgl/Dropbox/dicta/text-taggers/test_dynet.py", line 1, in <module>
    import dynet
  File "/usr/local/lib/python3.5/dist-packages/dyNET-0.0.0-py3.5-linux-x86_64.egg/dynet.py", line 17, in <module>
    from _dynet import *
ImportError: libdynet.so: cannot open shared object file: No such file or directory

即使使用仅包含 "import dynet".

的最小程序,我也会遇到同样的错误

我尝试通过几种方式重新安装 dynet:

$ sudo pip3 install dynet
Requirement already satisfied: dynet in /usr/local/lib/python3.5/dist-packages/dyNET-0.0.0-py3.5-linux-x86_64.egg (0.0.0)
Requirement already satisfied: cython in /usr/local/lib/python3.5/dist-packages (from dynet) (0.25.2)
Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages (from dynet) (1.12.1)

还有:

$ sudo -H pip3 install git+https://github.com/clab/dynet#egg=dynet
Requirement already satisfied: dynet from git+https://github.com/clab/dynet#egg=dynet in /usr/local/lib/python3.5/dist-packages/dyNET-0.0.0-py3.5-linux-x86_64.egg (0.0.0)
Requirement already satisfied: cython in /usr/local/lib/python3.5/dist-packages (from dynet) (0.25.2)
Requirement already satisfied: numpy in /usr/local/lib/python3.5/dist-packages (from dynet) (1.12.1)

但是程序还是不行...我该怎么办?

编辑:这是命令行中的 python 版本:

Python 3.5.2 (default, Nov 12 2018, 13:43:14) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/home/erelsgl/.local/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/home/erelsgl/git/PrefLib-Tools/preflibtools', '/usr/local/lib/python3.5/dist-packages/xgboost-0.6-py3.5.egg', '/usr/local/lib/python3.5/dist-packages/dyNET-0.0.0-py3.5-linux-x86_64.egg', '/usr/lib/python3/dist-packages']

注意:最近我安装了 conda,所以我认为这可能是原因,但现在我已将其删除,但问题仍然存在。

您的 dynet 安装中似乎缺少已编译的共享对象文件。这可能是由于与安装或卸载其他程序有关的任何事故造成的。最好的办法是尝试卸载并重新安装 dynet,看看它是否有效。

如果这不起作用,请尝试在虚拟环境中安装 dynet