报错Command ‘[‘ninja‘,‘-v‘]‘ returned non-zero exit status 1;RuntimeError: Error compiling objects for

【我是在服务器上操作的,没有root权限】

在python setup.py develop的时候先出现了报错

Command '['ninja','-v']' returned non-zero exit status 1;

RuntimeError: Error compiling objects for extension

  • 百度上搜索到的其中一个解决方案是修改/home/{用户名}/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/cpp_extension.py的['ninja','-v']改为['ninja','--v']或['ninja','--version'](此方法解决了Command '['ninja','-v']' returned non-zero exit status 1报错,但紧接着出现了g++之类的报错。总之该方法对我不适用)
  • 百度上很多帖子都是说pytorch版本问题,解决方案都是把pytorch降低到1.0版本左右,但是我的项目需要用到mmcv-full,而pytorch1.0无法安装mmcv-full。经过一系列卸载重装后,最后问题成功解决。

我使用的版本是

CUDA 10.1.105

python 3.7

pytorch 1.4.0

torchvision 0.5.0

gcc 7.3

mmcv 0.5.5

mmdetection 2.0

在度娘搜索过程中,我按照提示在/home/{用户名}/.bashrc中添加了一些环境变量

export CUDA_HOME=/usr/local/cuda-10.1

export CUDA_PATH=/usr/local/cuda-10.1

export CUDA_ROOT=/usr/local/cuda-10.1

export CUDA_HOST_COMPILER=/usr/bin/gcc-7.3

export CUDANN_INCLUDE_DIR=/usr/local/cuda-10.1/include

export CUDANN_LIB_DIR=/usr/local/cuda-10.1/lib64

export PATH="/usr/local/cuda-10.1/bin:$PATH"

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64"

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib"

export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/cuda-10.1/lib64"

 

 

你可能感兴趣的:(目标检测,环境搭建,linux,cuda,python,pytorch,setup.py)