(已解决)踩坑记录:Windows 11安装pointops编译时报错

正常来说,在命令行使用以下步骤进行编译安装:

复制代码
cd Pointcept/libs/pointops
python setup.py install

但是Windows系统下,会出现各种报错如下:

报错一:AttributeError

AttributeError: 'NoneType' object has no attribute 'split'

解决方案为修改Pointcept/libs/pointops/setup.py文件,将下面的代码

python 复制代码
(opt,) = get_config_vars("OPT")
os.environ["OPT"] = " ".join(
    flag for flag in opt.split() if flag != "-Wstrict-prototypes"
)

替换为

python 复制代码
(opt,) = get_config_vars("OPT")
# os.environ["OPT"] = " ".join(
#     flag for flag in opt.split() if flag != "-Wstrict-prototypes"
# )

报错二:PyTorch与CUDA不兼容

The detected CUDA version (12.2) mismatches the version that was used to compile PyTorch (11.3). Please make sure to use the same CUDA versions.

解决方案为使用匹配的PyTorch与CUDA,本人版本为:CUDA11.3+torch1.11.0+VS2019(VS版本很重要,后面会有)

不一定非要和我的版本号一致,但是一定要确保安装torch时,不要使用太高版本的CUDA,我使用12.x的CUDA环境安装torch,会显示编译torch时使用的CUDA版本过高,影响后续操作。

报错三:MSVC编译失败

报错内容特别长,但是最关键的内容只有:

fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2019 (inclusive) are supported!

或者提示没有安装 Windows 必需的 C++ 编译工具(cl.exe),所以 ninja 编译器根本找不到 C 语言编译器等等(这个应该只是警告)

之前本机只安装了VS2022,尝试过卸载MSVC2022只安装MSVC2019,从VS2022的命令行编译,失败。最后的解决方案是下载VS2019(可以与2022共存,下载地址:Visual Studio 2026/2022/2019/2017 Web Installer Direct download link),然后使用x64 Native Tools Command Prompt for VS 2019进行编译。

编译前输入下面的代码(解决C++和python的环境冲突)

python 复制代码
set DISTUTILS_USE_SDK=1

再次尝试编译,结果如下图,完结撒花。

相关推荐
MIXLLRED12 小时前
Windows 搭建《动手学深度学习》PyTorch 环境:从安装到踩坑记录
pytorch·windows·深度学习
fogota12 小时前
C# `string.Join` 处理 `List<int>`
windows·c#
律宏阔1 天前
WSL Docker 端口明明空闲,但就是绑不上端口
linux·windows
律宏阔1 天前
Windows 禁用联想笔记本所有 Lenovo 后台服务
windows
律宏阔1 天前
WSL 突然断网,无法 ping 内网或外网
linux·windows
小羊没烦恼!6 天前
初探性能优化——2个月到4小时的性能提升
java·开发语言·windows·算法·c#
rockmelodies6 天前
# Windows Server2008 R2 Standard(SP1镜像U盘)重置本地管理员密码【完整详细步骤】
windows·密码破解
kakakahahahaha7 天前
Windows C盘空间不足的安全清理与迁移流程
windows·电脑·笔记本电脑·软件需求·c盘清理
做咩啊~7 天前
远程连接提示:身份验证错误,要求的函数不受支持
windows
百事牛科技7 天前
PPT只读怎么取消?四种情况分别处理
windows·powerpoint