【问题标题】:I'm getting error when I import stream from tweepy从 tweepy 导入流时出现错误
【发布时间】:2013-12-29 21:14:24
【问题描述】:

我在尝试from tweepy import stream时收到此错误消息

ImportError: cannot import name stream

知道我在我的 python 上安装了 tweepy

【问题讨论】:

  • 请与我们分享一些代码。
  • 正如亚历克在回答中提到的那样,您可能在导入方面存在问题。看看这个:stackoverflow.com/questions/16867504 他们正在使用一些来自 tweepy 的 Stream,这可能是你想要的
  • 从 tweepy 导入流中导入 tweepy

标签: python


【解决方案1】:

虽然查看您的代码确实会有所帮助,但看起来您正在使用该行

from tweepy import stream

正确吗?

当我查看 tweepy 测试时,看起来 Stream 应该大写。查看此页面以获取示例:

https://github.com/tweepy/tweepy/blob/master/examples/streaming.py

在 Python 中导入(以及 Python 中的所有内容)时,大小写很重要。所以尝试将行更改为

from tweepy import Stream

【讨论】:

    【解决方案2】:

    你有一行代码如下:

    import stream
    

    在某个地方,Python 不知道你在做什么。 - 这就是您出现此错误的原因。

    为了获得更多帮助,我们需要更多代码,最好是你的 python 路径。

    【讨论】:

    • 我安装了 tweepy 并编写了这些代码:import tweepy, from tweepy import stream
    • @GalalAli 我对此不以为然(答案来自......我没有写出来 - 提到它)尝试大写的 S
    猜你喜欢
    • 2017-11-18
    • 1970-01-01
    • 2021-07-29
    • 1970-01-01
    • 2017-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-05
    相关资源
    最近更新 更多