运行python setup.py build install报错

运行python setup.py build install报错_第1张图片
报错如上:
/usr/include/wchar.h(582): error: attribute “malloc” does not take arguments

15 errors detected in the compilation of “/home/pytorch/InImage/ops_dc3/src/cuda/dcnv3_cuda.cu”.
error: command ‘/usr/local/cuda-11.5/bin/nvcc’ failed with exit code 1

还有报错:
RuntimeError:
The detected CUDA version (11.7) mismatches the version that was used to compile
PyTorch (10.2). Please make sure to use the same CUDA versions.

原因:g++是11.3版本,版本不匹配
https://discuss.pytorch.org/t/detected-cuda-version-11-7-mismatches-the-version-that-was-used-to-compile-pytorch-10-2/153348
解决方法:按https://blog.csdn.net/tangjiahao10/article/details/125501412的方法把g++降到10版本

你可能感兴趣的:(python,深度学习,pytorch)