Tweepy won't install on python 3.7; shows “syntax error”

有些话、适合烂在心里 提交于 2019-11-28 14:16:48

Using async as an identifier has been deprecated since Python 3.5, and became an error in Python 3.7, because it's a keyword.

This Tweepy bug was reported on 16 Mar, and fixed on 12 May, but there hasn't been a new release yet. Which is why, as the repo's main page says:

Python 2.7, 3.4, 3.5 & 3.6 are supported.


For the time being, you can install the development version:

pip3 install git+https://github.com/tweepy/tweepy.git

Or, since you've already installed an earlier version:

pip3 install --upgrade git+https://github.com/tweepy/tweepy.git

You could also follow the instructions from the repo:

git clone https://github.com/tweepy/tweepy.git
cd tweepy
python3 setup.py install

However, this will mean pip may not fully understand what you've installed.

In Python3.7, async became a reserved word (as can be seen in whats new section here) and therefore cannot be used as argument. This is why this Syntax Error is raised.

That said, and following tweetpys official GitHub (here), only

Python 2.7, 3.4, 3.5 & 3.6 are supported.


However, if you really must use Python3.7, there is a workaround. Following this suggestion, you can

open streaming.py and replace async with async_

and it should work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!