在 Python 中使用 Tweepy IDE 时出现错误?
Getting error while using Tweepy IDE in Python?
这只是一个下载时间线推文的简单程序,我正在调用我的密钥,然后在身份验证后重定向它以下载我的推文。
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)
但是当我执行这个模块时,我得到错误:
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'
我真的很震惊,我想不出哪里错了。我试图找到有关此错误的信息,但无济于事。
您必须安装 six
才能使用 tweepy。使用 pip 安装它,
pip install six
如果您使用的是 virtualenv,您可以使用 ,
检查 six
是否安装在 virtualenv 中
pip freeze
您似乎没有 tweepy
的基本 six
库。 tweepy
确实需要几个依赖项,您可以查看 here 了解更多详情。
您可以使用
安装six
pip install six
或
easy_install six
或者您可以从 Christoph Gohlke 的站点下载 binary 软件包并安装它
http://www.lfd.uci.edu/~gohlke/pythonlibs/#six
希望对您有所帮助。
这只是一个下载时间线推文的简单程序,我正在调用我的密钥,然后在身份验证后重定向它以下载我的推文。
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)
但是当我执行这个模块时,我得到错误:
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'
我真的很震惊,我想不出哪里错了。我试图找到有关此错误的信息,但无济于事。
您必须安装 six
才能使用 tweepy。使用 pip 安装它,
pip install six
如果您使用的是 virtualenv,您可以使用 ,
检查six
是否安装在 virtualenv 中
pip freeze
您似乎没有 tweepy
的基本 six
库。 tweepy
确实需要几个依赖项,您可以查看 here 了解更多详情。
您可以使用
安装six
pip install six
或
easy_install six
或者您可以从 Christoph Gohlke 的站点下载 binary 软件包并安装它
http://www.lfd.uci.edu/~gohlke/pythonlibs/#six
希望对您有所帮助。