1

我正在使用 Ubuntu,并通过文档中记录的命令安装了 bigquery 命令行工具:“easy_install bigquery”(不带引号 - 另请参阅https://developers.google.com/bigquery/bq-command-line-tool#安装) - 由于对 python2.7 路径的访问权限导致错误,我不得不将命令更改为“sudo easy_install bigquery”。

现在每次我尝试从命令行运行命令“bq”时,都会出现以下错误:“IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/bigquery-2.0 .14-py2.7.egg/EGG-INFO/requires.txt'"

如果我使用命令“sudo bq”运行它,它运行良好,但我想运行 bigquery 而不必将它作为 sudo 运行。我确定我做错了什么,但我不知道是什么。有什么建议么?

这是完整的跟踪:

:~$ bq
Traceback (most recent call last):
  File "/usr/local/bin/bq", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2803, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 696, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 599, in resolve
    requirements.extend(dist.requires(req.extras)[::-1])
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2235, in requires
    dm = self._dep_map
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2227, in _dep_map
    for extra,reqs in split_sections(self._get_metadata(name)):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2759, in split_sections
    for line in yield_lines(s):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1915, in yield_lines
    for ss in strs:
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2249, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1219, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1211, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1326, in _get
    stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/bigquery-2.0.14-py2.7.egg/EGG-INFO/requires.txt'

谢谢,

4

2 回答 2

2

检查/usr/local/lib/python2.7/dist-packages/bigquery-2.0.14-py2.7.egg和子文件夹的权限。

于 2013-09-09T20:42:31.733 回答
-1

我知道这可能晚了一年,但我找到了解决方案;基本上,您必须以“root”管理员身份登录才能访问可以在 Linux 操作系统中编辑任何内容的点。为此,您必须使用您的 vps 帐户(您的普通帐户)登录您的终端,然后发出命令

sudo passwd root”。

这将提示您使用密码创建一个 root 帐户(在其他 ubuntu 版本上可能会有所不同)。然后要访问你创建的这个“root”帐户,你重新启动你的电脑,打开终端,然后发出命令

" su"

以 root 用户身份登录;使用“sudo”执行命令。

于 2014-04-25T18:50:34.397 回答