【发布时间】:2020-01-07 14:53:07
【问题描述】:
我已经安装了 twint:
pip3 install twint
这导致安装成功:
Successfully installed twint-2.1.8
它可以使用命令提示符(CLI)命令从twitter 获取推文,但是当我尝试在Spyder IDE 中运行示例时,它给了我错误:
"Traceback (most recent call last):
File "<ipython-input-13-7b77905cef0c>", line 1, in <module>
runfile('C:/Users/myname/twint.py', wdir='C:/Users/myname')
File "C:\Users\myname\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Users\myname\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/myname/twint.py", line 8, in <module>
import twint
File "C:\Users\myname\twint.py", line 9, in <module>
c = twint.Config()
AttributeError: module 'twint' has no attribute 'Config'
这是我的代码:
import twint
c = twint.Config()
c.Username = "twitterAccountName"
twint.run.Search(c)
但是,我在 GitHub 上查看了与 twint 相关的问题,发现 here 但此处提供的解决方案对我不起作用。有谁知道错误来自哪里?我该如何解决?
【问题讨论】:
标签: python-3.x config python-module attributeerror