【问题标题】:installing and using python-oauth2安装和使用 python-oauth2
【发布时间】:2013-02-18 20:06:03
【问题描述】:

我安装了 oauth2:

$ pip install oauth2

但是运行 python-oauth2/example/client.py 会返回:

Traceback (most recent call last):
  File "client.py", line 31, in <module>
    import oauth.oauth as oauth
ImportError: No module named oauth.oauth

我测试了 pip freeze:

oauth2==1.5.211

提前致谢

【问题讨论】:

  • 您的目录中是否有一个名为oauth 的本地模块? import oauth 有效吗?如果有,print(oauth.__file__) 会给你什么?
  • 嗨,Martijn。没有本地模块。我获得了&gt;&gt;&gt; print(oauth.__file__) Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; NameError: name 'oauth' is not defined import oauth return: import oauth ImportError: No module named oauth
  • 这消除了至少一个常见错误。如果你运行head `which plip`,它会告诉你安装包的python是什么;您确定这与您在示例中使用的 python 相同吗?
  • 似乎示例目录代码 (https://github.com/simplegeo/python-oauth2) 用于 oauth 而不是 oauth2。对吗?
  • 这是另一个选项,example 目录是 b0rken 并且使用了错误的包名称。 :-P

标签: python oauth oauth-2.0


【解决方案1】:

事实证明,oauth2 包中的example 目录应该被忽略。就包而言,它是损坏的代码。

有关其他人发现此问题的示例,请参阅这些问题:

最后一个是一个拉取请求,其中包含 示例来代替使用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-29
    • 2014-12-22
    • 2012-05-30
    • 1970-01-01
    相关资源
    最近更新 更多