Jupyter notebooks 中的 python3 安装模块 API Client 错误



我正在尝试将google analytics API连接到我的Jupyter Notebook,但在尝试安装库时出现错误。

import argparse
from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
from oauth2client import client
from oauth2client import file
from oauth2client import tools

返回的错误:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-4f9f833c28f1> in <module>()
      1 import argparse
      2 
----> 3 from apiclient.discovery import build
      4 from oauth2client.service_account import ServiceAccountCredentials
      5 
ModuleNotFoundError: No module named 'apiclient'

我基本上正在使用这个演示,当我在终端中将其作为 python 应用程序运行时它可以工作,但是当我将代码移动到 jupyter 时,它开始抛出该错误。

我试过:

pip3 install --upgrade google-api-python-client终端中的一切都是最新的

!pip3 install google-api-python-client笔记本中并返回所有内容都是最新的。

我正在使用 anaconda 进行本地 jupyter 安装,如果这有什么不同的话。关于如何解决此问题或其他尝试的任何想法?

试试另一个:

pip install --force-reinstall google-api-python-client

如果它不起作用,请在此处下载 zip,然后将其解压缩到您的 App Engine 项目中即可。

最新更新