Python|Windows 系统安装 triton 的方法

若未安装,则在运行调用了该仓库的 Python 脚本时,会报错如下:

ModuleNotFoundError: No module named 'triton'

在 Windows 系统中,如果直接使用 pip 安装,会报错如下:

pip install triton

 

ERROR: Could not find a version that satisfies the requirement triton (from versions: none)
ERROR: No matching distribution found for triton

这是因为 pypi 中的 triton 中没有适用于 Python 的版本。

解决方法
Step 1|在 HuggingFace 上下载 triton 的 Windows 包:https://hf-mirror.com/madbuda/triton-windows-builds

 

Step 2|在下载路径下 pip install 安装 whl 文件即可:

pip install triton-2.1.0-cp311-cp311-win_amd64.whl

后续问题
如果继续抛出如下异常,可能是版本不匹配,暂未找到合适的解决方法。

ModuleNotFoundError: No module named 'triton.common'

如果在 unsloth 用到,那么通常因为 unsloth 通常是用来显卡加速的,可以尝试暂时卸载 unsloth 解决。

posted @ 2025-03-02 14:07  ring军  阅读(1390)  评论(0)    收藏  举报