cmd - 错误 AttributeError:模块 'twint' 没有属性 'config'
问题描述
我已经安装twint
了:
git clone --depth=1 https://github.com/twintproject/twint.git
cd twint
pip3 install . -r requirements.txt
这导致安装成功:
Successfully installed twint-2.1.21
它可以使用命令提示符(cmd.exe)命令从 twitter 获取推文,但是当我尝试在 jupyter notebook 中运行该示例时,它给了我错误:
AttributeError Traceback (most recent call last)
<ipython-input-6-f48dbefa5025> in <module>
1 # Configure
----> 2 c = twint.Config()
3 c.Search = "wfh"
4
5 # Run
AttributeError: module 'twint' has no attribute 'Config'
这是我的代码:
import twint
# Configure
c = twint.Config()
c.Search = "wfh"
# Run
twint.run.Search(c)
解决方案
只需将脚本 twint 安装在“/home/yourusername/.local/bin”中的位置添加到路径。
export PATH="/home/yourusername/.local/bin:$PATH"
您需要获取 .bashrc 或注销/登录(或重新启动终端)才能使更改生效。要获取 .bashrc,只需键入
source ~/.bashrc
然后重新启动你的 jupyter 笔记本。这应该解决它
推荐阅读
- python - RatemyProfessor 网站中的网页抓取“检查”元素部分
- sql - 带有 Pivot 和 Unpivot 的嵌套 SQL 左连接
- r - 使用 dplyr 对 R 中不同列(和不同行位置)的行进行操作
- elixir - 无法通过“Flow.through_specs/3”的自定义阶段传递流程
- python - wxPython 将文件拖放到图像上,以添加到数组
- ios - 在 iOS 中为 RTL 更改 NavigationBar 显示方向
- javascript - 如何从网页调用 exe(HTML、JavaScript)
- html - 按钮在反应中没有理由
- python - 获取每个组的前 n 个条目,其中每个组的 n 不同
- html-email - Outlook 2010 的电子邮件模板中出现白色间隙