简体   繁体   English

使用Python 3.4安装tweepy2

[英]Installing tweepy2 with Python 3.4

I successfully installed tweepy2 with Python 3.4 on Windows 7. But when I type import tweepy (in the command line of Python) it gives me this message: 我在Windows 7上成功安装了带有Python 3.4的tweepy2。但是,当我输入import tweepy (在Python的命令行中)时,它会显示以下消息:

Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tweepy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\site-packages\tweepy-2.3-py3.4.egg\tweepy\__init__.py", line 12, in <module>
  File "C:\Python34\lib\site-packages\tweepy-2.3-py3.4.egg\tweepy\models.py", line 5, in <module>
  File "C:\Python34\lib\site-packages\tweepy-2.3-py3.4.egg\tweepy\utils.py", line 6, in <module>
ImportError: cannot import name 'quote'

How can I solve that error? 我该如何解决该错误?

The Tweepy package is not Python 3 compatible . Tweepy软件包与Python 3不兼容 It will only work with Python 2. 它仅适用于Python 2。

The line that fails is: 失败的行是:

from urllib import quote

which is only available in that location on Python 2. The package documentation clearly states this too: 仅在Python 2上的该位置可用。 软件包文档也明确指出了这一点:

Note only Python 2.6 and 2.7 are supported at the moment. 请注意,目前仅支持python 2.6和2.7。 The Python 3 family is not yet supported. 尚不支持Python 3系列。

You'll have to use a different package to interface with Twitter. 您必须使用其他程序包才能与Twitter交互。 The Twitter Developer documentation lists several options: Twitter Developer文档列出了几个选项:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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