1.根据网上的apex编译安装方法,使用anaconda prompt编译安装apex成功后,在prompt终端可以import apex成功。
(1)下载apex工程
git clone https://github.com/NVIDIA/apex && cd apex
(2)编译安装
pip3 install --user -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
但是在pycharm中无法import apex。
原因可能是编译好的apex没有加到系统变量中,导致pycharm搜索不到apex的路径。
2.解决方法
直接在pycharm中使用Terminal进行编译