我正在尝试使用 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 导入 Stream、StreamListener
文件“C:\Users\joshey\AppData\Local\Programs\Python\Python37\lib\site-packages\tweepy\streaming.py”,第 355 行
def _start(自身,异步):
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安装或者代码有问题吗?
谁能帮我找出问题所在吗?
提前致谢。
“pip install tweepy”当前仍然无法在 python 3.7 上运行,请回滚到 3.6.OB1(并忽略 pip 更新建议)。
那么应该可以工作:)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)