【问题标题】:Google Drive OAuth2谷歌云端硬盘 OAuth2
【发布时间】:2016-02-18 18:54:13
【问题描述】:

我正在尝试使用以下详细信息在 python 和谷歌驱动器之间同步:

授权的 JavaScript 来源:http://localhost:8080

授权重定向 URI:http://localhost:8080/

我将 json 文件复制到目录并运行此代码:

from pydrive.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LocalWebserverAuth()

我得到了这个错误:

from oauth2client.locked_file import LockedFile
ImportError: No module named locked_file

你能帮帮我吗?

【问题讨论】:

    标签: python oauth-2.0 google-drive-api google-oauth


    【解决方案1】:

    有同样的问题。 看起来oauth2client 的最新版本v2.0.0 发生了变化,它破坏了与google-api-python-client 模块的兼容性,现在已修复https://github.com/adrian-the-git/google-api-python-client/commit/2122d3c9b1aece94b64f6b85c6707a42cca8b093,因此升级google-api-python-client 恢复了兼容性并使一切都恢复正常:

    $ pip install --upgrade git+https://github.com/google/google-api-python-client
    

    【讨论】:

    • git+https 到底是做什么的?我以前从未见过。谢谢。
    • 据我所知 git+https 使用 git over https (而不是直接使用 ssh 或 git),如果你在代理后面,这有好处,因为 git 协议通常不接受你的代理设置,但您需要特别添加 - 因此我总是在公司代理后面使用 git+https。在您的情况下,您可能只使用 git:// 或 git+ssh:// 或 https:// 或 git+https:// 在reddit.com/r/Python/comments/2crput/… 上对该主题进行了完整的讨论,其他人声称 git+ https:// 是“官方”的首选方式。
    • 为此我们不得不添加 --target /Library/Python/2.7/site-packages 出于某种原因。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多