Win10 22H2下Python3.12/3.13无法安装llama-index求助
安装Microsoft Visual C++ Build Tools
下载并安装微软官方的Visual Studio Build Tools,勾选「Desktop development with C++」组件,确保包含C++核心工具集、Windows SDK等必要内容。安装完成后重启终端,再执行pip install llama-index。手动安装预编译numpy包
下载对应Python版本(3.12/3.13)和系统架构(x64)的numpy<2.0.0预编译.whl文件,通过pip install [本地wheel文件路径]安装,跳过编译步骤。切换国内PyPI镜像源安装
执行命令pip install llama-index -i https://pypi.tuna.tsinghua.edu.cn/simple,国内镜像提供更全的预编译包,大概率能直接获取无需编译的依赖版本。配置环境变量
将Python的Scripts目录,以及Visual Studio Build Tools的编译器目录(例如C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64)添加到系统PATH环境变量中,重启终端后重试安装。借助conda环境安装
若已安装conda,创建并激活新环境:conda create -n llama_env python=3.12 conda activate llama_env然后执行
conda install llama-index,conda会自动处理预编译依赖,避免编译报错。
内容的提问来源于stack exchange,提问作者Eric Mellier

