云昴(Mao Yun)

Windows 安装 Apex (CUDA)

| 【专业·学习】Apex

常见报错

Apex 在 Win10安装情况下,会出现以下报错:

Error checking compiler version for cl.exe
RuntimeError: Error compiling objects for extension
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "e:\miniconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
    return stream.closed
ValueError: underlying buffer has been detached
Running setup.py install for apex ... error

解决方法

第一个将C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64加入环境变量即可,注意自己安装VS MSVC的版本。

第二个以及其他类似的编译错误,解决方案:

git clone https://github.com/NVIDIA/apex.git
cd apex
git checkout f3a960f80244cf9e80558ab30f7f7e8cbf03c0a0
python setup.py install --cuda_ext --cpp_ext

回退旧版即可。中途折腾了很久。包括一些别的方法:https://github.com/NVIDIA/apex/issues/839

云昴(Mao Yun)