Tensorflow NotFoundError:libtensorflow_framework.so:无法打开共享文件或目录

时间:2019-07-04 13:14:43

标签: python tensorflow

我在Windows Subsystem for Linux的Ubuntu 16.04版本中使用带有Python 2.7的Tensorflow 1.14.0(随pip一起安装)。我正在运行另一个人编写的脚本,它给我以下错误:

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/load_library.py", line 61, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: libtensorflow_framework.so: cannot open shared object file: No such file or directory

我发现this post,其中用户自己找到了丢失的libtensorflow_framework.so文件,然后导航到/usr/local/lib/python2.7/dist-packages/tensorflow,在其中找到了lib_tensorflow_framework.so.1文件。我尝试重命名该文件以最后删除.1,然后尝试重新运行该脚本,但是随后出现错误消息,提示它找不到.so.1文件!如果我运行find . -name libtensorflow_framework.so,将没有结果。在哪里可以找到此文件?

2 个答案:

答案 0 :(得分:1)

不要重命名文件,请将libtensorflow_framework.so的符号链接添加到libtensorflow_framework.so.1

cd /usr/local/lib/python2.7/dist-packages/tensorflow/

# If you renamed the file, rename it back
mv libtensorflow_framework.so libtensorflow_framework.so.1

# Create a symlink so both .so and .so.1 point to the same file
ln -s libtensorflow_framework.so.1 libtensorflow_framework.so

答案 1 :(得分:0)

libtensorflow_framework.so可能不存在。也许您可以尝试find . -name libtensorflow_framework.so1