我正在尝试在AWS EC2计算机上使用名为csvkit
的Python包。我可以在一些打嗝之后安装它,这可能是相关的 - 运行pip install csvkit
引发错误
with open(path, 'rb') as stream:
IOERROR: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg/EGG-INFO/requires.txt'
但我可以用其他命令安装它。
现在解决原始问题 - 当我尝试在csvkit
包中运行一个简单的函数,如cavstat
时,这是完整的错误输出:
[username ~]$ csvstat
Traceback (most recent call last):
File "/usr/local/bin/csvstat", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3020, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 614, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 920, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 815, in resolve
new_requirements = dist.requires(req.extras)[::-1]
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2552, in requires
dm = self._dep_map
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2537, in _dep_map
for extra, reqs in split_sections(self._get_metadata(name)):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2978, in split_sections
for line in yield_lines(s):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2252, in yield_lines
for ss in strs:
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2566, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1589, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1581, in get_metadata
return self._get(self._fn(self.egg_info, name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1692, in _get
with open(path, 'rb') as stream:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg/EGG-INFO/requires.txt'
我不确定甚至可以搜索什么来查看问题。这与date-utils
有关吗?
我对Linux世界还不熟悉,所以编辑配置文件对我来说有点困难。
答案 0 :(得分:1)
如果您通过'pip install csvkit'进行系统范围的安装,那么您将需要为当前用户提供sudo权限,这就是为什么安装过程已经开始修改/ usr / local / lib / python2 .7结构。
如果您使用的是自己创建的AWS实例,则可以非常简单地为当前用户设置sudo权限。
如果您正在寻找更多包含的替代方案,您可以安装virtualenv并设置一个隔离的virtualenv(https://virtualenv.pypa.io/en/latest/installation.html),但virtualenv对于一次性服务器可能过度。
这有帮助吗?