我编写了一个使用Google Sheets 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'
有什么建议吗?
Googleapiclient仅安装在python2(我想是您的默认python版本)上,而不安装在python3上。
使用以下命令在python3 env中安装Googleapiclient:
pip3 install --upgrade google-api-python-client