python3.7 windows10 cuda11.1 pytorch1.8.1 虚拟环境miniconda
目的windows下载github中的torchlars包
遇到的问题问题一:直接下载好文件夹输入指令:python setup.py install 出现错误:RuntimeError: Error compiling objects for extension 解决方法:应先输入python setup.py build develop
问题二:subprocess.CalledProcessError: Command ‘[‘ninja’, ‘-v’]’ returned non-zero exit status 1. 解决方法: 修改torchlars 中的setup文件:
# cmdclass={'build_ext': BuildExtension},cmdclass={'build_ext': BuildExtension.with_options(use_ninja=False)}, 具体步骤1、检查Microsoft Visual Studio的版本(需2017、2019),如没有Microsoft Visual Studio或者版本不对,会出现bug: fatal error C1189: #error: – unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag ‘-allow-unsupported-compiler’ can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. error: command ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe’ failed with exit code 2
2、python setup.py build develop 3、python setup.py install