Windows 下 Pytorch需要編譯cpp文件,出現(xiàn)如下錯(cuò)誤:
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
我安裝的VS2022,那么需要重新安裝VS2019么?
其實(shí)不需要,正如上面提示,編譯時(shí)加個(gè)參數(shù)即可。
?舊代碼:
upfirdn2d_op = load(
"upfirdn2d",
sources=[
os.path.join(module_path, "upfirdn2d.cpp"),
os.path.join(module_path, "upfirdn2d_kernel.cu"),
],
)
加一行,新代碼:?文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-511402.html
upfirdn2d_op = load(
"upfirdn2d",
sources=[
os.path.join(module_path, "upfirdn2d.cpp"),
os.path.join(module_path, "upfirdn2d_kernel.cu"),
],
extra_cuda_cflags=['-allow-unsupported-compiler'],
)
也就是加上一行:? ?extra_cuda_cflags=['-allow-unsupported-compiler'],?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-511402.html
到了這里,關(guān)于Pytorch unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2019的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!