-
先下载安装包,先git到本地,如果没有Git 请先安装git,如果git网络错误请手动下载(不要直接pip install apex)
$ git clone https://github.com/NVIDIA/apex
$ cd apex
-
激活conda环境,conda activate your_name
-
python setup.py install
-
可能遇到的问题:TypeError:unsupported operand type(s)for+:'None Type 'and 'str。
解决方法:可能是因为将apexa安装到一个没有GPU的环境上,可以先尝试:
export TORCH_CUDA_ARCH LIST="compute capability"再执行安装
如果错误仍然没有解决,这意味着conda可能不是完整版本,也就是nvcc还没有安装,因此可以尝试
conda install -c nvidia cuda-nvcc