python - Tweepy 未在 anaconda jupyter 上运行

标签 python anaconda tweepy conda-forge

我已经在 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

最佳答案

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

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

Okay found the solution. Apparently async cannot be used as an argument name in Python 3.7 So open streaming.py and replace #async with async_ it fixed the error for me.

关于python - Tweepy 未在 anaconda jupyter 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55815833/

相关文章:

python - Tweepy 引用状态 "Status has no attribute quoted_status"

python - 获取嵌套字典中所有键的列表

anaconda - 运行 jupyter Notebook 后连接被拒绝(503 错误)

python - pulp.solvers.PulpSolverError : PuLP: cannot execute glpsol. exe

python - 导入 numpy : `pthread_creat error in blas_thread_init function` 时出现 OpenBLAS 错误

python - 无法在 Mac OS X 终端上使用 pip 安装 Tweepy

python - 如何在 Python 中的 Opencv Camera 窗口中提供开始、停止、捕获和关闭按钮

python - 关于在 Debug模式下编译Python的问题

python - 使用 pytorch 对分割图像进行热编码

python - Tweepy StreamListener : Tweet when a specified account Tweets