我已经使用以下命令安装了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)命令从推特获取推文,但当我尝试在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)发布于 2021-08-17 22:33:17
只需将脚本twint在'/home/yourusername/.local/bin‘中的安装位置添加到path。
export PATH="/home/yourusername/.local/bin:$PATH"要使更改生效,您需要获取您的.bashrc或注销/登录(或重新启动终端)。要获取.bashrc的源代码,只需键入
source ~/.bashrc然后重启你的jupyter笔记本。这应该可以解决这个问题
https://stackoverflow.com/questions/67141185
复制相似问题