之前配过python的pytorch1.2采用的是cuda10.0版本 使用了此链接下载libtorch:
https://download.pytorch.org/libtorch/cu100/libtorch-win-shared-with-deps-latest.zip
也可以去官网下载 :
https://pytorch.org/get-started/locally/
需要解决问题
需要配置
头文件h库文件libdll文件
VS2019创建一个项目 【调试】– 【调试属性】
添加头文件include路径 选择你解压libtorch对应的路径下的include
库文件
添加库文件lib路径 选择你解压libtorch对应的路径下的lib
将你所需要的库文件输入 即是你lib文件夹下的所有.lib文件
c10_cuda.lib caffe2_detectron_ops_gpu.lib caffe2_module_test_dynamic.lib caffe2_nvrtc.lib clog.lib cpuinfo.lib libprotobuf.lib libprotobuf-lite.lib libprotoc.lib torch.lib
dll文件
PATH E:p21 deepLearninglibtorchlib;%PATH%
需要对应的执行文件 否则运行程序会出现找不到xxx.dll文件的情况
测试案例
#include iostream
#include torch/torch.h
using namespace std;
int main()
torch::Tensor tensor torch::rand({ 5,3 });
cout tensor endl;
system( pause );
return 0;
结果输出 即可安装成功



