twython - No module named twython error

2019-06-03 11:30发布

I installed tywthon on my raspberry pi using the following command:

sudo pip install twython

There were no errors during the install. When I run my python file it comes up with:

ImportError: No module named twython

Code is as follows:

import sys
import datetime
from twython import Twython

#Twitter keys

CONSUMER_KEY="xxx"
CONSUMER_SECRET ="xxx"
ACCESS_KEY = "xxx"
ACCESS_SECRET ="xxx"

api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET)

dt=datetime.datetime.now()
mon=4-dt.month
day=18-dt.day
hr=23-dt.hour
mn=60-dt.minute
sec=60-dt.second

pythonTest("Hi, I'm using my raspberry pi and python to tweet status     updates.")
python_string=("Time until Ben's birthday: "+str(mon)+" Months, "+str(day)+" days, "+str(hr)+" hours, "+str(mn)+" minutes")

api.update_status(status=python_Test)   

I am using python 3. Not sure if that matters or not?

0条回答
登录 后发表回答