ImportError: No module named tweepy - In python
ich versuche zu tun, eine Sentiment-Analyse, die mit AWS wie im folgenden Abschnitt erläutert
http://docs.aws.amazon.com/gettingstarted/latest/emr/getting-started-emr-sentiment-tutorial.html
Alles ging gut, bis ich traf die folgende Fehlermeldung
[ec2-user@ip-10-65-140-113 sentiment -]$ ls
code eingeben herecollector.py twaiter.py twaiter.pyc twitterparams.py
[ec2-user@ip-10-65-140-113 sentiment]$ **collector.py kindle**
-bash: collector.py: command not found
[ec2-user@ip-10-65-140-113 sentiment]$ python collector.py kindle
Traceback (most recent call last):
File "collector.py", line 6, in <module>
from twaiter import TWaiter
File "/home/ec2-user/sentiment/twaiter.py", line 5, in <module>
from tweepy import StreamListener
**ImportError: No module named tweepy**
Jede Hilfe, warum dies sein könnte. twaiter.py mit dem folgenden Inhalt. Ich öffnete die twaiter.py um zu sehen, Linie 5 und ist hier
[ec2-user@ip-10-65-140-113 sentiment]$ vi twaiter.py
1 # based on http://badhessian.org/2012/10/collecting-real-time-twitter-data-w ith-the-streaming-api/
2 # with modifications by http://github.com/marciw
3 # requires Tweepy https://github.com/tweepy/tweepy
4
5 from tweepy import StreamListener
6 import json, time, sys
7
8 class TWaiter(StreamListener):
9
10 # see Tweepy for more info
11
12 def __init__(self, api = None, label = 'default_collection'):
13 self.api = api or API()
14 self.counter = 0
15 self.label = label
16 self.output = open(label + '.' + time.strftime('%b%d-%H%M') + '.txt ', 'w')
17 self.deleted = open('deleted_tweets.txt', 'a')
18
19 def on_data(self, data):
20 # The presence of 'in_reply_to_status' indicates a "normal" tweet.
@
- Der Fehler sagt alles - die
tweepy
Modul nicht importiert werden. Sind Sie sicher, dass es installiert ist?
Du musst angemeldet sein, um einen Kommentar abzugeben.
Die Meldung "ImportError: No module named tweepy" zeigt deutlich, dass die ec2-Maschine nicht mit tweepy-Bibliothek installiert ist. Also während der Ausführung der aktuellen python-Skript, es ist nicht in der Lage, ihn zu suchen und deshalb eine import-Fehler.
Es gibt mehrere Möglichkeiten zum installieren von tweepy. Eine einfache Möglichkeit, Sie in Linux-Maschine
sudo pip install tweepy
Andere Möglichkeiten sind:
http://code.google.com/p/tweepy/
Können Sie bekommen zu einem tutorial wiki-Seite für Sie zu der Google-Code-link.
Installieren es mit easy_install, führen Sie einfach easy_install tweepy
Installieren mit git:
git clone git://github.com/joshthecoder/tweepy.git
cd tweepy
python setup.py installieren
Installieren Sie es von der Quelle, die Quelle download http://pypi.python.org/pypi/tweepy laufen dann so etwas wie:
tar xzvf tweepy-1.7.1.tar.gz
cd tweepy-1.7.1
python setup.py installieren
Entnehmen Sie bitte Wo und wie kann ich das installieren von twitter Python-API? für weitere details.
Auch, wenn weitere Fehler finden ImportError: No module named tweepy