【问题标题】:Tweepy is not running on anaconda jupyterTweepy 没有在 anaconda jupyter 上运行
【发布时间】:2019-04-23 16:39:34
【问题描述】:

我已经在 anaconda promptconda install -c conda-forge tweepy 上安装了 tweepy,但我收到以下错误任何想法?

 import tweepy

输出:

Traceback (most recent call last): 
File "C:\Users\user\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns) 
File "<ipython-input-1-f5e4f2180e08>", line 1, in <module> import tweepy 
File "C:\Users\user\Anaconda3\lib\site-packages\tweepy\__init__.py", line 17, in <module> from tweepy.streaming import Stream, StreamListener 
File "C:\Users\user\Anaconda3\lib\site-packages\tweepy\streaming.py", line 358 def _start(self, async): 
                                                                                                    ^ 
 SyntaxError: invalid syntax

【问题讨论】:

    标签: python anaconda tweepy conda-forge


    【解决方案1】:

    这个 GitHub 问题有答案:https://github.com/tweepy/tweepy/issues/1017#issuecomment-387703653

    本质上,async 是 Python 3.7 中的保留关键字,不能用作函数参数。引用问题的相关部分:

    好的,找到了解决方案。显然 async 不能用作 Python 3.7 中的参数名称所以打开 streaming.py 并替换 #async 使用 async_ 它为我修复了错误。

    【讨论】:

    • 你的意思是对于 def _start(self, async) 将是 def _start(self, async_it) 对吧?
    • @tfirinci 因为错误在第 358 行,您应该从该行开始查找。
    • @AviThour 如果引用自github issue,请注明是引用并使用blockquote格式(以&gt;开头的行)
    • @darthbith 感谢您的提示,已添加到答案中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-30
    • 2017-04-12
    • 1970-01-01
    • 1970-01-01
    • 2019-08-14
    相关资源
    最近更新 更多