简体   繁体   中英

Getting error while using Tweepy IDE in Python?

It's just a simple program to download timeline tweet,I am calling my keys and then after authentication redirect it to download my tweet.

import tweepy
auth = tweepy.OAuthHandler('My consumer key', 'My consumer secret')
auth.set_access_token('My access token', 'My access token secret')
api = tweepy.API(auth)
public_tweets = api.home_timeline()
for tweet in public_tweets:
    print (tweet.text)

But when I Execute this module, I get Error as:

Traceback (most recent call last):
  File "C:/Python34/tweepy1.py", line 1, in <module>
    import tweepy
  File "C:\Python34\lib\site-packages\tweepy-3.4.0-py3.4.egg\tweepy\__init__.py", line 12, in <module>
    from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResults, ModelFactory, Category
  File "C:\Python34\lib\site-packages\tweepy-3.4.0-py3.4.egg\tweepy\models.py", line 7, in <module>
    from tweepy.utils import parse_datetime, parse_html_value, parse_a_href
  File "C:\Python34\lib\site-packages\tweepy-3.4.0-py3.4.egg\tweepy\utils.py", line 9, in <module>
    import six
ImportError: No module named 'six'

I am really struck , I can't make out where I went wrong . I tried to find about this error but to no avail.

Seem you don't have the essential six library for tweepy . tweepy does need several dependencies, you can check here for more details.

You can install six using

pip install six

or

easy_install six

or you can download the binary package from Christoph Gohlke's site and install it

http://www.lfd.uci.edu/~gohlke/pythonlibs/#six

Hope it helps.

You must install six in order to use tweepy. Install it using pip as,

pip install six

In case if you are using virtualenv, you can check six is installed or not in virtualenv using ,

pip freeze

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM