正在安装 google api 客户端以从 python 发送电子邮件
Installing google api client to send emails from python
我正在尝试学习如何使用 Gmail API 在 python 中发送电子邮件。
我脚本的第一行之一:
from googleapiclient.discovery import build
给我错误:
No module named googleapiclient.discovery
我正在尝试通过以下方式安装 googleapiclient:
sudo pip install --upgrade google-api-python-client
它似乎在做所有正确的事情直到最后它说:
Installing collected packages: httplib2, uritemplate, rsa, cachetools, pyasn1-modules, google-auth, google-auth-httplib2, google-api-python-client
Found existing installation: httplib2 0.9.1
Cannot uninstall 'httplib2'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
我不确定这条消息是否会阻止它工作,但我仍然收到消息:
No module named googleapiclient.discovery
当我尝试 运行 我的代码时。非常感谢收到任何建议!
OP 面临着提到的类似问题 here。
在大多数情况下,使用--user
选项安装软件包将解决此问题。安装包之前。我们必须先卸载 google-api-python-client
。
pip uninstall google-api-python-client
现在 install
使用 --user
选项的包。
pip install --user google-api-python-client
我正在尝试学习如何使用 Gmail API 在 python 中发送电子邮件。
我脚本的第一行之一:
from googleapiclient.discovery import build
给我错误:
No module named googleapiclient.discovery
我正在尝试通过以下方式安装 googleapiclient:
sudo pip install --upgrade google-api-python-client
它似乎在做所有正确的事情直到最后它说:
Installing collected packages: httplib2, uritemplate, rsa, cachetools, pyasn1-modules, google-auth, google-auth-httplib2, google-api-python-client
Found existing installation: httplib2 0.9.1
Cannot uninstall 'httplib2'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
我不确定这条消息是否会阻止它工作,但我仍然收到消息:
No module named googleapiclient.discovery
当我尝试 运行 我的代码时。非常感谢收到任何建议!
OP 面临着提到的类似问题 here。
在大多数情况下,使用--user
选项安装软件包将解决此问题。安装包之前。我们必须先卸载 google-api-python-client
。
pip uninstall google-api-python-client
现在 install
使用 --user
选项的包。
pip install --user google-api-python-client