cp: 不是通过悬挂的符号链接 '/usr/lib/x86_64-linux-gnu/libhdf5.so' 写的

cp: not writing through dangling symlink '/usr/lib/x86_64-linux-gnu/libhdf5.so'

我遇到了这个问题,能否请您给我一些解决方法的提示:

$sudo cp ~/anaconda2/lib/libhdf5* /usr/lib/x86_64-linux-gnu/
cp: not writing through dangling symlink '/usr/lib/x86_64-linux-gnu/libhdf5.so'
cp: not writing through dangling symlink '/usr/lib/x86_64-linux-gnu/libhdf5_hl.so'

谢谢

我发现这个问题有点过时了,但无论如何:

悬挂符号链接实际上是损坏的符号链接,指向任何地方。
因此,在这种情况下,必须检查目标路径(可能已移动到某处)或使用 cp 的参数 --remove-destination.

来自 man cp 页:

--remove-destination
    remove  each existing destination file before attempting to open
    it (contrast with --force)