You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用InstaPy时遇ModuleNotFoundError:找不到clarifai.rest模块

解决InstaPy导入时出现ModuleNotFoundError: No module named 'clarifai.rest'的问题

问题原因

clarifai模块的新版本已移除clarifai.rest子模块结构,而InstaPy依赖的是旧版clarifai的API,直接安装最新版clarifai会导致导入失败。

解决方案

  1. 安装兼容的clarifai旧版本
    先卸载现有clarifai,再指定安装2.6.2版本(经测试该版本与InstaPy兼容):

    pip uninstall -y clarifai
    pip install clarifai==2.6.2
    
  2. 确保VSCode使用的Python环境与模块安装环境一致

    • 查看VSCode左下角显示的Python解释器路径
    • 打开终端,使用该路径对应的pip执行安装命令,避免环境不匹配(比如虚拟环境场景):
      • Linux/macOS:/path/to/your/python/env/bin/pip install clarifai==2.6.2
      • Windows:C:\path\to\your\python\env\Scripts\pip.exe install clarifai==2.6.2
  3. 重新安装InstaPy并确认依赖安装
    若上述步骤无效,可彻底重装InstaPy,确保依赖被正确安装:

    pip uninstall -y instapy
    pip install instapy
    

验证

安装完成后,在Python交互终端执行以下命令,确认无报错后再运行你的InstaPy代码:

from clarifai.rest import ClarifaiApp, Workflow

内容的提问来源于stack exchange,提问作者Once4thewin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 13:07:07