error: #error C++17 or later compatible compiler is required to use PyTorch.

背景

在安装wonder3d的时候要安装tinycudnn,

  • 命令如下:
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
  • 报错如下:

error: #error C++17 or later compatible compiler is required to use PyTorch.

解决方法:

参考本文:https://github.com/open-mmlab/mmdeploy/issues/2529,

核心是把setup.py 里面的
extra_compile_args={“cxx”: ????} 这个???改成[‘-std=c++14’]:

extra_compile_args['cxx'] = ['-std=c++14']
if parse_version(torch.__version__) >= parse_version('2.0.0'):
    extra_compile_args['cxx'] = ['-std=c++17']

所以步骤如下:

  • git clone --recursive https://github.com/NVlabs/tiny-cuda-nn
  • 进去修改setup.py, extra_compile_args['cxx'] = ['-std=c++17']
    • 我这里是把
    • extra_compile_args={"cxx": cflags, "nvcc": nvcc_flags},修改为
    • extra_compile_args={"cxx": ["-std=c++17"], "nvcc": nvcc_flags},
    • 注意,外面的[]不要漏了
  • 然后在本地安装:pip install tiny-cuda-nn/bindings/torch

相关推荐

  1. LeetCode 每日一题 2023/12/11-2023/12/17

    2024-06-06 15:48:35       42 阅读
  2. <span style='color:red;'>12</span>.<span style='color:red;'>11</span>

    12.11

    2024-06-06 15:48:35      41 阅读
  3. <span style='color:red;'>12</span>.<span style='color:red;'>11</span>

    12.11

    2024-06-06 15:48:35      37 阅读
  4. 12.15

    2024-06-06 15:48:35       47 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-06 15:48:35       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-06 15:48:35       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-06 15:48:35       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-06 15:48:35       18 阅读

热门阅读

  1. shell 支持多线程

    2024-06-06 15:48:35       7 阅读
  2. 【前端每日基础】day34——HTTP和HTTPS

    2024-06-06 15:48:35       7 阅读
  3. 常用系统命令/参数/工具统计

    2024-06-06 15:48:35       9 阅读
  4. MyBatis 入门详解

    2024-06-06 15:48:35       8 阅读
  5. 政府窗口服务第三方评估报告如何写

    2024-06-06 15:48:35       7 阅读
  6. 【Linux】System V 消息队列(不重要)

    2024-06-06 15:48:35       10 阅读
  7. 服务器硬件介绍(2)

    2024-06-06 15:48:35       10 阅读