环境详情:

  • ​CUDA11.2​​安装正确
  • ​Pytorch1.8.0-cu11.1​​版本安装正确

报错信息

在安装​​torch-cluster​​​和​​torch-scatter​​时,直接如下命令安装报错:

pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.8.0+cu112.html

Python——报错解决:error: command ‘:/usr/local/cuda-11.2/bin/nvcc‘ failed: No such file or directory_解决方法

解决方法

  • 首先确定你是存在​​/usr/local/cuda-11.2/bin/nvcc​​文件的:
/usr/local/cuda-11.2/bin/nvcc -V

Python——报错解决:error: command ‘:/usr/local/cuda-11.2/bin/nvcc‘ failed: No such file or directory_html_02

那么报如上错误就是权限问题,解决方法也很简单,给sudo权限即可,我这里使用的conda环境,因此在执行时务必指定conda的python执行器。

  • 查询Conda的Python执行器:
whereis python

Python——报错解决:error: command ‘:/usr/local/cuda-11.2/bin/nvcc‘ failed: No such file or directory_解决方法_03

  • ​sudo​​+指定python路径执行pip下载命令:
sudo /home/innox/anaconda3/envs/fiery/bin/python3.7 -m pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.8.0+cu112.html

成功安装~

Python——报错解决:error: command ‘:/usr/local/cuda-11.2/bin/nvcc‘ failed: No such file or directory_html_04