如下:
Running setup.py install for detectron2 ... error
ERROR: Command errored out with exit status 1:
command: /home/jackytsai/anaconda3/envs/detectron2/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-yf9eibzp/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-yf9eibzp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-k2u582k2/install-record.txt --single-version-externally-managed --compile --install-headers /home/jackytsai/anaconda3/envs/detectron2/include/python3.6m/detectron2
这里发现我的cuda版本和gcc不兼容,解决这个问题要么更新cuda要么更新gcc,我选择了后者,我把我的gcc从7.3更新到了6.5,具体操作如下:
sudo apt-get install gcc-6 g++-6 g++-6-multilib gfortran-6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
sudo update-alternatives --config gcc
参考链接: https://askubuntu.com/questions/1039856/downgrade-gnu-compilers-ubuntu-18-04