raspbian:ModuleNotFoundError:没有名为“google_auth_oauthlib”的模块

问题描述

我正在尝试安装一个执行以下操作的 Python 脚本:

from google_auth_oauthlib.flow import InstalledAppFlow

但是执行时返回的错误是:

pi@raspBerrypi:~ $ /usr/bin/python3 /usr/lib/python3/dist-packages/google/google_calendar_service.py
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/google/google_calendar_service.py",line 3,in <module>
    from google_auth_oauthlib.flow import InstalledAppFlow
ModuleNotFoundError: No module named 'google_auth_oauthlib'

我尝试在 distutils setup.py 中插入“google-auth-oauthlib”作为要求,无论有没有版本,还尝试了包的名称python3-google-auth-oauthlib”,但没有任何效果

install_requires=['google-api-python-client>=2.3.0','google-auth-oauthlib>=0.4.1','google-auth>=1.30.0','python3-google-auth-oauthlib'],

最后我尝试手动安装:

sudo pip install google-auth-oauthlib
Looking in indexes: https://pypi.org/simple,https://www.piwheels.org/simple
Collecting google-auth-oauthlib
  Downloading https://files.pythonhosted.org/packages/7b/b8/88def36e74bee9fce511c9519571f4e485e890093ab7442284f4ffaef60b/google_auth_oauthlib-0.4.1-py2.py3-none-any.whl
Collecting google-auth (from google-auth-oauthlib)
  Downloading https://files.pythonhosted.org/packages/d2/c1/44179a1cfc5c3b5832a5f9c925161612471ec5f346bcd186235651d74f35/google_auth-1.30.0-py2.py3-none-any.whl (146kB)
    100% |████████████████████████████████| 153kB 46kB/s 
Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/lib/python2.7/dist-packages (from google-auth-oauthlib) (1.0.0)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python2.7/dist-packages (from google-auth->google-auth-oauthlib) (1.12.0)
Requirement already satisfied: setuptools>=40.3.0 in /usr/lib/python2.7/dist-packages (from google-auth->google-auth-oauthlib) (40.8.0)
Collecting pyasn1-modules>=0.2.1 (from google-auth->google-auth-oauthlib)
  Downloading https://files.pythonhosted.org/packages/95/de/214830a981892a3e286c3794f41ae67a4495df1108c3da8a9f62159b9a9d/pyasn1_modules-0.2.8-py2.py3-none-any.whl (155kB)
    100% |████████████████████████████████| 163kB 43kB/s 
Collecting rsa<4.6; python_version < "3.6" (from google-auth->google-auth-oauthlib)
  Downloading https://files.pythonhosted.org/packages/26/f8/8127fdda0294f044121d20aac7785feb810e159098447967a6103dedfb96/rsa-4.5-py2.py3-none-any.whl
Collecting cachetools<5.0,>=2.0.0 (from google-auth->google-auth-oauthlib)
  Downloading https://files.pythonhosted.org/packages/2f/a6/30b0a0bef12283e83e58c1d6e7b5aabc7acfc4110df81a4471655d33e704/cachetools-3.1.1-py2.py3-none-any.whl
Collecting pyasn1<0.5.0,>=0.4.6 (from pyasn1-modules>=0.2.1->google-auth->google-auth-oauthlib)
  Downloading https://files.pythonhosted.org/packages/62/1e/a94a8d635fa3ce4cfc7f506003548d0a2447ae76fd5ca53932970fe3053f/pyasn1-0.4.8-py2.py3-none-any.whl (77kB)
    100% |████████████████████████████████| 81kB 66kB/s 
Installing collected packages: pyasn1,pyasn1-modules,rsa,cachetools,google-auth,google-auth-oauthlib
Successfully installed cachetools-3.1.1 google-auth-1.30.0 google-auth-oauthlib-0.4.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 rsa-4.5

还是一样的错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)