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

已安装snscrape模块仍遇ModuleNotFoundError,求解决方法

解决snscrape模块导入报错的方案

以下是针对ModuleNotFoundError: No module named 'snscrape'问题的具体解决步骤:

  • 确认Python环境一致性
    很多时候安装和运行代码用的不是同一个Python环境:

    • 分别执行python --version和pip --version,检查两者的Python版本和路径是否匹配;
    • 若使用虚拟环境,先激活对应环境,再重新执行安装命令;
    • 针对Python3环境,尝试用pip3 install snscrape替代pip安装。
  • 重新安装snscrape
    先彻底卸载现有版本,再重新安装:

    1. 卸载命令:pip uninstall -y snscrape
    2. 重新安装官方稳定版:pip install snscrape
    3. 若PyPI版本存在问题,可从源码安装:pip install git+https://github.com/JustAnotherArchivist/snscrape.git
  • 检查IDE解释器配置
    如果你用VSCode、PyCharm等IDE开发:

    • 确认项目所选的Python解释器是已安装snscrape的版本;
    • 以VSCode为例,按Ctrl+Shift+P打开命令面板,选择Python: Select Interpreter切换到正确的环境。
  • 验证安装有效性
    打开终端进入Python交互模式,执行import snscrape,若未报错则安装成功,再回到代码中运行即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.24 12:24:18