1、在终端执行:git clone https://github.com/torch/distro.git ~/torch --recursive
在你的home根目录下生成一个torch文件夹
2、进入torch目录,执行:bash install-deps
3、执行:./install.sh
遇到问题:
more than one operator “==” matches these operands
解决方法:
原因在于cuda和torch的头文件都提供了相同的重载运算符,这样编译器在使用的时候就会出现混乱。
解决方法:禁止使用cuda的头文件编译torch
终端输入export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"
再重新执行:./install.sh
输入:yes
4、输入yes后执行source ~/.bashrc添加环境变量
5、输入:th测试是否安装成功
参考:
1、https://blog.csdn.net/jacke121/article/details/79616554
2、https://blog.csdn.net/mumoDM/article/details/80703406?utm_source=blogxgwz5