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

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

相关推荐
2601_9679873721 小时前
安装 Redis 或 Redis Stack
linux·windows·redis·macos·安装
xbzb1 天前
自定义 yum 软件源:Linux 上 createrepo,Windows 上纯 Python 也能造
linux·运维·windows·python·yum·createrepo
武雄(小星Ai)1 天前
Ollama报llama-server binary not found排坑实录:服务活着引擎没了
人工智能·windows·大模型·ollama·排坑
叼烟扛炮2 天前
[LangChain] 学习笔记(06):突破大模型限制——结构化输出(Structured Output)
windows·笔记·学习·langchain
Thneonl2 天前
桌宠穿透不是一行 SetWindowLong
windows·程序员
艺杯羹3 天前
Windows原生软件锁设计:从暴力杀进程丢数据到零轮询事件驱动架构
windows·系统架构·开源·开源软件·内存管理·开源协议
csdn_aspnet3 天前
Redis 入门:Windows、Mac安装指南
数据库·windows·redis·缓存·mac
没差c4 天前
winsw将jar、nginx等注册为Windows服务
windows·nginx·jar
光谱SpectrAI4 天前
Claude Code 2.1.318 的隐私模块:4 条命令,拦了 2 条
windows
Hello_Pyhx4 天前
NWinfo 导出 Windows 硬件信息:从 JSON 报告到缺项排查
windows·json