两种解决方法
复制文件法
- 我的libtorch安装目录在**/usr/share**
- 将 /usr/share/libtorch/include下所有文件复制到**/usr/local/include/**目录下
sudo cp -rf /usr/share/libtorch/include/* /usr/local/include/
- 将usr/local/include/torch/csrc/api/include/torch下的文件创建软链接到usr/local/include/torch目录下
sudo ln -s /usr/local/include/torch/csrc/api/include/torch/* /usr/local/include/torch/
- 我喜欢这种方法,一劳永逸,但是管理该目录下的头文件会很麻烦