简体   繁体   English

如何使用 python-oauth2

[英]how to python-oauth2

I install python-oauth2 with pip install oauth2 and I find the dir named 'oauth2' in /usr/lib/python2.7/dist-packages But from pyoauth2 import Client,AccessToken say: no moudles named pyoauth2 Then, I changed pyoauth2 to oauth2 , same status.我用pip install oauth2安装了 python-oauth2,我在/usr/lib/python2.7/dist-packages找到了名为 'oauth2' 的目录但是from pyoauth2 import Client,AccessToken说:没有名为 pyoauth2 的模块然后,我将pyoauth2更改为oauth2 ,相同的状态。 I download the source code from https://github.com/douban/douban-client我从https://github.com/douban/douban-client下载源代码

I think you are installing the wrong package.我认为您安装了错误的软件包。 Try with pip install pyoauth2 .尝试使用pip install pyoauth2

oauth2 is a different package and does not define AccessToken . oauth2是一个不同的包,没有定义AccessToken

It that works you can pip uninstall oauth2它可以工作,您可以pip uninstall oauth2

Have you had problems with pip in the past?您过去是否遇到过 pip 问题?

Also have you tried to simply import oauth2 without specifying Client and AccessToken.您是否也尝试过在不指定 Client 和 AccessToken 的情况下简单地导入 oauth2。

I pip installed oauth2 (windows) and AccessToken wasn't not found.我 pip 安装了 oauth2 (windows) 并且没有找到 AccessToken。

Also, are you running python in a separate terminal from the one which you called the pip install?另外,您是否在与您称为 pip install 的终端不同的终端中运行 python? You will have to restart python.您将不得不重新启动python。

Worst case scenario, restart your machine.最坏的情况,重启你的机器。

Does any of this help?这些有帮助吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM