在开始之前,我想先声明一下,我对 python 还比较陌生,在我的这个小项目之前没有太多使用它。我正在尝试将 twitter 机器人作为艺术项目的一部分,但我似乎无法导入 tweepy。我正在使用 macOS High Sierra 和 Python 3.7。我首先使用安装了 tweepy
pip3 install tweepy
这似乎有效,因为我能够在 finder 中找到 tweepy 文件。但是,当我简单地输入
import tweepy
进入 IDLE,我得到这个错误:
Traceback (most recent call last):
File "/Users/jacobhill/Documents/CicadaCacophony.py", line 1, in <module>
import tweepy
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tweepy/__init__.py", line 17, in <module>
from tweepy.streaming import Stream, StreamListener
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tweepy/streaming.py", line 358
def _start(self, async):
^
SyntaxError: invalid syntax
关于如何解决这个问题的任何想法?我在这里查看了其他帖子,其他错误似乎与“找不到 tweepy 模块”类似,所以我不知道如何处理我的错误。谢谢!