Tweepy 流媒体错误
Tweepy streaming error
我正在尝试使用 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 行
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 更新建议)。
应该可以了:)
用 async_
替换 async
对我有用。
如 user10459541 所述,将 async 替换为 async_ 有效。
只需打开 Lib\site-packages\tweepy 路径中的 streaming.py 文件,并用记事本上的查找和替换功能替换所有出现的地方
我正在尝试使用 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 行 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 更新建议)。
应该可以了:)
用 async_
替换 async
对我有用。
如 user10459541 所述,将 async 替换为 async_ 有效。
只需打开 Lib\site-packages\tweepy 路径中的 streaming.py 文件,并用记事本上的查找和替换功能替换所有出现的地方