Googleapiclient和python3

问题描述 投票:2回答:1

我编写了一个使用Google表格API的基本Python 3脚本。它适用于默认为Python 3(Arch)的系统。我正在尝试在Ubuntu 14.04系统上运行相同的脚本,但我无法加载apiclient库。我安装了推荐的pip install --upgrade google-api-python-client但是我注意到我只能在python 2中加载库。

这是我正在观察的内容:

~ $ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from googleapiclient import discovery
>>> quit()
~ $ python3
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from googleapiclient import discovery
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'googleapiclient'

有什么建议?

python debian google-api-client
1个回答
7
投票

Googleapiclient仅安装在python2上(我猜是你的默认python版本)而不是python3。

使用以下命令在python3 env中安装Googleapiclient:

pip3 install --upgrade google-api-python-client
© www.soinside.com 2019 - 2024. All rights reserved.