Googleapiclient和python3

时间:2017-11-22 06:42:51

标签: python debian google-api-client

我编写了一个使用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'

有什么建议吗?

2 个答案:

答案 0 :(得分:7)

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

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

pip3 install --upgrade google-api-python-client

答案 1 :(得分:0)

python -m  pip install --upgrade google-api-python-client