(已解决)踩坑记录: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

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

相关推荐
芊&星16 小时前
靶机应急 | 知攻善防----Windows
运维·windows·安全
likerhood17 小时前
Java final 关键字:从“不能改”到“安全发布”的深入理解
java·windows·安全
clear sky .18 小时前
[freeRTOS源码阅读]list.c/h
linux·服务器·windows
星间都市山脉18 小时前
Windows 环境 Android 系统 APK 签名操作文档
android·windows
薛定猫AI21 小时前
Codex 与 Claude Code 全平台安装配置指南(Windows / macOS / Linux)
linux·windows·macos
console.log('npc')1 天前
Windows 11 安装 WSL2 + Ubuntu + Docker + Codex + Sub2API 教学
windows·docker·powershell·ubantu·codex
Mr_hwt_1231 天前
Windows安装Claude Code详细教程(含apikey配置)
windows·ai编程·claude code
Languorous.1 天前
Windows 安装 Linux 虚拟机 / WSL 完整教程(新手零失败)
linux·运维·windows
郭龙飞9801 天前
OpenClaw技能拓展教程 五大场景高效办公实操指南
人工智能·windows·语言模型
小鹿软件办公1 天前
在 Windows 中什么是 iphlpsvc?禁用它安全吗?
windows·安全·iphlpsvc