查看已安装torch版本
下载对应的vision版本
我安装的torch1.7.1版本
git checkout v0.8.2
https://github.com/pytorch/vision/tree/v0.8.2
mkdir build
cd build
# Add -DWITH_CUDA=on support for the CUDA if needed
cmake -DCMAKE_PREFIX_PATH=/path/to/libtorch -DCMAKE_INSTALL_PREFIX=/where/to/install/torchvision -DCMAKE_BUILD_TYPE=Release -DWITH_CUDA=on ..
sudo make
sudo make install
安装在/usr/local/下include,lib,share文件夹中,也可参考此文进行安装
https://blog.youkuaiyun.com/flag_ing/article/details/109708155