我正在尝试使用 tweepy 和 textblob 分析推文的情绪。我做了 pip install tweepy 并且它安装成功,但我收到以下错误。
错误消息:文件“C:\Users\joshey\Desktop\sent.py”,第 2 行,导入 tweepy 文件“C:\Users\joshey\AppData\Local\Programs\Python\Python37\lib\site-packages\ tweepy__init__.py”,第 17 行,从 tweepy.streaming 导入流,StreamListener 文件“C:\Users\joshey\AppData\Local\Programs\Python\Python37\lib\site-packages\tweepy\streaming.py”,行第355章
import tweepy
from textblob import TextBlob
consumer_key= 'CONSUMER_KEY_HERE'
consumer_secret= 'CONSUMER_SECRET_HERE'
access_token='ACCESS_TOKEN_HERE'
access_token_secret='ACCESS_TOKEN_SECRET_HERE'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
public_tweets = api.search('Trump')
for tweet in public_tweets:
print(tweet.text)
analysis = TextBlob(tweet.text)
print(analysis.sentiment)
print("")
tweepy安装或代码有什么问题吗?谁能帮我找出问题所在?我尝试使用谷歌搜索,但没有任何效果。提前致谢。
tweepy安装或代码有什么问题吗?谁能帮我找出问题所在?提前致谢。