AttributeError:module' tweepy'没有属性' OAuthHandler' ImportError:没有名为' tweepy.auth'

时间:2018-02-21 17:05:22

标签: python oauth oauth-2.0 twitter-oauth tweepy

enter code here 
import queue
import time
import tweepy
import re

consumer_key = 'c65mUHOn31bv4bw7ZqyAvsZLv'
consumer_secret = 'umxOyBGSkTNSnZW308wnh4m2AVmIlXgxUteAJL06riPteXqz5X'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)

+代码

runnig我得到了这个错误
Traceback (most recent call last):
  File "luckyBot.py", line 31, in <module>
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
AttributeError: module 'tweepy' has no attribute 'OAuthHandler'

我也尝试过:

from tweepy.auth import OAuthHandler
auth = OAuthHandler(consumer_key, consumer_secret)

但这让我犯了这个错误:

Traceback (most recent call last):
   File "luckyBot.py", line 7, in <module>
    from tweepy.auth import OAuthHandler
ImportError: No module named 'tweepy.auth'

0 个答案:

没有答案