我已经安装了带有的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笔记本中运行该示例时,它会给我错误:
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或logout/login(或重新启动终端(,更改才能生效。要获取.bashrc,只需键入
source ~/.bashrc
然后重新启动你的jupyter笔记本。这应该可以解决