我已经使用以下命令安装了twint:
pip3 install twint这将导致成功安装:
Successfully installed twint-2.1.8它可以使用命令提示符命令从twitter获取tweet,但当我尝试在Spyder集成开发环境中运行该示例时,它给出了以下错误:
"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上查找了与here相关的问题,但这里提供的解决方案对我不起作用。有人知道错误是从哪里来的吗?我该如何修复它?
发布于 2020-01-07 23:03:15
您链接到的问题与您遇到的问题完全相同。您需要将文件重命名为not twint.py
将此文件重命名为runfile('C:/Users/myname/twint.py
如果您收到其他错误,则这是一个单独的问题
https://stackoverflow.com/questions/59630828
复制相似问题