python - 获取 Google Analytics Embed API 服务器端授权的访问 token

标签 python command-line google-analytics sudo

我正在尝试为 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

如果有帮助请告诉我,

埃里克·拉方丹

关于python - 获取 Google Analytics Embed API 服务器端授权的访问 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39252779/

相关文章:

postgresql - 运行 postgresql 脚本时奇怪的从左到右的箭头

ios - 将 Google Analytics 更新到 3.0.1 后,Xcode 5 架构 i386 的 undefined symbol

google-analytics - 如何快速收集不同页面路径的页面浏览量?

google-analytics - Google Analytics 通用 - 增强的电子商务结账

Python - 创建模式列表

python - 如何在方案中像 python 一样追加?

c++ - 带有命令行应用程序的 MacOSX C++ 工作目录

python - 导入 pydrake.multibody.math 时出现导入错误

python - 编辑列表,同时将其与另一个列表作为约束进行比较

linux - 在特定终端中通过 Perl 运行 shell 命令