У меня есть проект на Python в Pycharm.Код выглядит так:
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
from kafka import SimpleProducer, KafkaClient
access_token = "56078905-nIhiZaeN6pe2GeNvppxItmO6ap6YYXKXfqqAjqt8f"
access_token_secret = "2ZD1RENb7jvXgR7TmDu6pKcgliCC3du89jG7hTibfeTI6"
consumer_key = "e8vFKglSgPeMFueUXX4e2bglB"
consumer_secret = "O85aPvR1u42NLinbjRbbmAb0ajN6gTVZXB4uGXfhASBdTda7jv"
class StdOutListener(StreamListener):
def on_data(self, data):
producer.send_messages("trump", data.encode('utf-8'))
print (data)
return True
def on_error(self, status):
print (status)
kafka = KafkaClient("localhost:9092")
producer = SimpleProducer(kafka)
l = StdOutListener()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
stream = Stream(auth, l)
stream.filter(track="trump")
Однако, когда я запускаю это, я получаю следующую ошибку:
Traceback (most recent call last):
File "/Users/nke09/kafkatest/twitterkafka.py", line 3, in <module>
from tweepy.streaming import StreamListener
File "/usr/local/lib/python3.6/site-packages/tweepy/__init__.py", line 12, in <module>
from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResults, ModelFactory, Category
File "/usr/local/lib/python3.6/site-packages/tweepy/models.py", line 7, in <module>
from tweepy.utils import parse_datetime, parse_html_value, parse_a_href
File "/usr/local/lib/python3.6/site-packages/tweepy/utils.py", line 9, in <module>
import six
ModuleNotFoundError: No module named 'six'
Я не понимаю, потому что у меня есть шесть установленных.