获取 Google Analytics Embed API 服务器端授权的访问令牌

Get Access Token for Google Analytics Embed API server side authorization

我正在尝试为 Google Analytics Embed API 设置服务器端授权。当我在命令行上 运行 时:

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

我收到这条消息:

The directory '/Users/XXXX/Library/Caches/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 '/Users/XXXX/Library/Caches/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.
Collecting google-api-python-client
  Downloading google_api_python_client-1.5.3-py2.py3-none-any.whl (50kB)
    100% |████████████████████████████████| 51kB 991kB/s 
Requirement already up-to-date: httplib2<1,>=0.8 in /Library/Python/2.7/site-packages (from google-api-python-client)
Collecting six<2,>=1.6.1 (from google-api-python-client)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting uritemplate<1,>=0.6 (from google-api-python-client)
  Downloading uritemplate-0.6.tar.gz
Collecting oauth2client<4.0.0,>=1.5.0 (from google-api-python-client)
  Downloading oauth2client-3.0.0.tar.gz (77kB)
    100% |████████████████████████████████| 81kB 2.5MB/s 
Collecting simplejson>=2.5.0 (from uritemplate<1,>=0.6->google-api-python-client)
  Downloading simplejson-3.8.2-cp27-cp27m-macosx_10_9_x86_64.whl (67kB)
    100% |████████████████████████████████| 71kB 6.8MB/s 
Collecting pyasn1>=0.1.7 (from oauth2client<4.0.0,>=1.5.0->google-api-python-client)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Collecting pyasn1-modules>=0.0.5 (from oauth2client<4.0.0,>=1.5.0->google-api-python-client)
  Downloading pyasn1_modules-0.0.8-py2.py3-none-any.whl
Collecting rsa>=3.1.4 (from oauth2client<4.0.0,>=1.5.0->google-api-python-client)
  Downloading rsa-3.4.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 6.1MB/s 
Installing collected packages: six, simplejson, uritemplate, pyasn1, pyasn1-modules, rsa, oauth2client, google-api-python-client
  Found existing installation: six 1.4.1
    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-yzJYPo-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

我以管理员身份登录。我已经加倍检查了目录和父目录的权限。我不确定我做错了什么?

我想您可能想阅读以下内容: https://github.com/pypa/pip/issues/3165

他们说你可以做到 :

sudo pip install --ignore-installed 6

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

如果有帮助请告诉我,

埃里克·拉方丹