/home/chenyang/.local/lib/python3.7/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.) return torch._C._cuda_getDeviceCount() > 0
export CUDA_VISIBLE_DEVICES=0,1,2,3
如果没解决
这个时候可以采用sudo aptitude install cuda 来安装,这种安装aptitude会自动把所有依赖的库都帮你顺着找到,并下载好。如果aptitude还未安装,可以先使用sudo apt-get install aptitude,先将aptitude安装好。在安装过程中,在选择【Y/N】,选择 Y 就行。
如果没解决
这个时候可以采用sudo aptitude install
装一遍所有的包