环境
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文章来源:https://www.toymoban.com/news/detail-623720.html
2、python setup.py build develop
3、python setup.py install文章来源地址https://www.toymoban.com/news/detail-623720.html
到了这里,关于【torchlars】windows下载github中的torchlars包遇到的问题及解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!