环境:
ubuntu18.04
python3.8.17
cuda: 11.3, V11.3.58
GPU : 3060 12g
nvidia-smi: NVIDIA-SMI 535.86.01 Driver Version: 536.67 CUDA Version: 12.2
pip install pycuda -i https://mirror.baidu.com/pypi/simple/
报错:
check.warn(importable)
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycuda
Failed to build pycuda
ERROR: Could not build wheels for pycuda, which is required to install pyproject.toml-based projects
解决办法,环境变量加入cuda配置:
vim ~/.bashrc
在最后加入下面3行:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda
然后执行: source ~/.bashrc