【问题标题】:How to Install Google APIs Client Library via terminal如何通过终端安装 Google API 客户端库
【发布时间】:2017-08-12 12:25:51
【问题描述】:

我尝试通过终端安装 Google APIs 客户端库,结果如下:

$ sudo pip install google-api-python-client

The directory '/home/masterqiao/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/masterqiao/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: google-api-python-client in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: httplib2<1dev,>=0.9.2 in /usr/local/lib/python2.7/dist-packages (from google-api-python-client)
Requirement already satisfied: oauth2client<5.0.0dev,>=1.5.0 in /usr/local/lib/python2.7/dist-packages (from google-api-python-client)
Requirement already satisfied: uritemplate<4dev,>=3.0.0 in /usr/local/lib/python2.7/dist-packages (from google-api-python-client)
Requirement already satisfied: six<2dev,>=1.6.1 in /usr/local/lib/python2.7/dist-packages (from google-api-python-client)
Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python2.7/dist-packages (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)
Requirement already satisfied: pyasn1-modules>=0.0.5 in /usr/local/lib/python2.7/dist-packages (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)
Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python2.7/dist-packages (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)

【问题讨论】:

  • 嗨,欢迎来到 Stack Overflow!请编辑您的问题并重新格式化,使其易于阅读。此外,这个问题可能与主题无关,因为它更类似于一般帮助问题而不是编程问题。

标签: python ubuntu google-api-python-client


【解决方案1】:

你可以通过两种方式做到这一点

选项 1:

varad@adithya-pc /tmp/venv/testPythonStacks $ source bin/activate
(testPythonStacks) varad@adithya-pc /tmp/venv/testPythonStacks $ pip install --upgrade google-api-python-client
Collecting google-api-python-client
  Downloading google_api_python_client-1.6.2-py2.py3-none-any.whl (52kB)
    100% |████████████████████████████████| 61kB 366kB/s 
Requirement already up-to-date: six<2dev,>=1.6.1 in ./lib/python2.7/site-packages (from google-api-python-client)
Collecting uritemplate<4dev,>=3.0.0 (from google-api-python-client)
  Downloading uritemplate-3.0.0-py2.py3-none-any.whl
Collecting oauth2client<5.0.0dev,>=1.5.0 (from google-api-python-client)
  Downloading oauth2client-4.0.0-py2.py3-none-any.whl (184kB)
    100% |████████████████████████████████| 194kB 1.0MB/s 
Collecting httplib2<1dev,>=0.9.2 (from google-api-python-client)
  Downloading httplib2-0.10.3.tar.gz (204kB)
    100% |████████████████████████████████| 204kB 908kB/s 
Collecting rsa>=3.1.4 (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)
  Downloading rsa-3.4.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 1.9MB/s 
Collecting pyasn1-modules>=0.0.5 (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)
  Downloading pyasn1_modules-0.0.8-py2.py3-none-any.whl
Collecting pyasn1>=0.1.7 (from oauth2client<5.0.0dev,>=1.5.0->google-api-python-client)
  Downloading pyasn1-0.2.3-py2.py3-none-any.whl (53kB)
    100% |████████████████████████████████| 61kB 1.7MB/s 
Building wheels for collected packages: httplib2
  Running setup.py bdist_wheel for httplib2 ... done
  Stored in directory: /home/varad/.cache/pip/wheels/ca/ac/5f/749651f7925b231103f5316cacca82a487810c22d30f011c0c
Successfully built httplib2
Installing collected packages: uritemplate, pyasn1, rsa, httplib2, pyasn1-modules, oauth2client, google-api-python-client
Successfully installed google-api-python-client-1.6.2 httplib2-0.10.3 oauth2client-4.0.0 pyasn1-0.2.3 pyasn1-modules-0.0.8 rsa-3.4.2 uritemplate-3.0.0
t

选项2:

1. wget https://pypi.python.org/packages/e8/04/4bb1672918e4fc6d6a8201bdaf986b9fb4763f2a47b11496186dbbbd40ce/google-api-python-client-1.6.2.tar.gz#md5=5efd35416d57e6571276a52f81d26bc7
2. tar -xvf google-api-python-client-1.6.2.tar.gz
3. cd google-api-python-client-1.6.2
4. python setup.py build
5. sudo python setup.py install

【讨论】:

  • 这个办法已经解决问题了。谢谢。
【解决方案2】:

试试这个

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

你可以参考这个answer或official documentation

【讨论】:

  • masterqiao@masterqiao-Rev-1-0:~$ sudo pip install --upgrade google-api-python-client 目录'/home/masterqiao/.cache/pip/http'或其父目录不属于当前用户,缓存已被禁用。请检查该目录的权限和所有者。如果使用 sudo 执行 pip,您可能需要 sudo 的 -H 标志。目录 '/home/masterqiao/.cache/pip' 或其父目录不属于当前用户,并且缓存轮已被禁用。检查该目录的权限和所有者。如果使用 sudo 执行 pip,您可能需要 sudo 的 -H 标志。
  • 你不是管理员? @qiao
  • 是的,我是管理员。
猜你喜欢
  • 2016-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多