gpt4 book ai didi

python - twitter Api 使用 python 给出错误

转载 作者:行者123 更新时间:2023-12-01 05:57:17 25 4
gpt4 key购买 nike

hi i am new to python and i got this error but i have installed twitter but it's giving this error

import twitter
api=twitter.Api()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
api=twitter.Api()
AttributeError:'module' object has no attribute 'Api'

我不知道这个错误,因为我几乎有与 twitter 相关的每个包

Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
api = twitter.Api()
AttributeError: 'module' object has no attribute 'Api'

当我发出这个命令时python setup.py install_data它给出这样的错误运行install_data

Traceback (most recent call last) :
file "setup.py" ,line 47 , <module>
""" ,
File "C:\python26\lib\distutils\core.py" ,line 152 , in setup
dist.run_commands()
File "C:\python26\lib\distutils\dist.py" ,line 975 , in run_commands
self.run_command(cmd)
File "C:\python26\lib\distutils\dist.py" ,line 995 , in run_commands
command_obj.run
File "C:\python26\lib\distutils\command\install_data.py" , line 44 in run
For f in self.data_files

最佳答案

您可以使用重新安装吗,

sudo pip install twitter

sudo easy_install twitter

旧版本不需要 OAuth,但新版本需要。最新版本的文档需要这些来启动API

>>> api = twitter.Api(consumer_key='consumer_key',

consumer_secret='consumer_secret', access_token_key='access_token', access_token_secret='access_token_secret')

关于python - twitter Api 使用 python 给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11835882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com