源码安装twint 2.1.21后Jupyter Notebook报无Config属性错误
安装环境说明
- 通过源码拉取方式执行安装命令如下:
git clone --depth=1 https://github.com/twintproject/twint.git cd twint pip3 install . -r requirements.txt
- 安装全程无报错,终端提示成功安装twint-2.1.21版本
- 在系统命令提示符(cmd.exe)中调用twint执行Twitter推文爬取任务,功能运行正常
异常报错情况
- 在Jupyter Notebook中运行测试代码时,触发模块属性缺失类报错,完整报错栈为:
AttributeError Traceback (most recent call last) <ipython-input-6-f48dbefa5025> in <module> 1 # 配置爬取参数 ----> 2 c = twint.Config() 3 c.Search = "wfh" 4 5 # 启动爬取任务 AttributeError: module 'twint' has no attribute 'Config'
Jupyter中执行的测试代码
import twint # 配置爬取参数 c = twint.Config() c.Search = "wfh" # 启动爬取任务 twint.run.Search(c)
内容的提问来源于stack exchange,提问作者potatos
相关产品推荐
相关产品推荐

