pkg_resources.ExtractionError:无法将文件提取到egg cache:[Errno 13]权限被拒绝:

时间:2014-08-25 19:04:07

标签: python pip setuptools easy-install

所以,我几天来一直在与这个持续存在的问题作斗争,这是我最近的死胡同:

我想卸载cx_Oracle以重启。我发现this表示这样做的方法是删除egg文件。

所以我做了:

rm -rf /Users/xxx/.python-eggs/cx_Oracle-5.1.3-py2.7-macosx-10.8-x86_64.egg-tmp/

我现在看到的是我的阅读理解失败,但已完成的工作已经完成。

然后我尝试运行脚本并得到:

 File "time_reporting.py", line 31, in <module>
    import cx_Oracle
  File "build/bdist.macosx-10.8-x86_64/egg/cx_Oracle.py", line 7, in <module>
  File "build/bdist.macosx-10.8-x86_64/egg/cx_Oracle.py", line 4, in __bootstrap__
  File "build/bdist.macosx-10.8-x86_64/egg/pkg_resources.py", line 951, in resource_filename
    err.manager        = self
  File "build/bdist.macosx-10.8-x86_64/egg/pkg_resources.py", line 1647, in get_resource_filename
    def get_importer(path_item):
  File "build/bdist.macosx-10.8-x86_64/egg/pkg_resources.py", line 1677, in _extract_resource
    except ImportError:
  File "build/bdist.macosx-10.8-x86_64/egg/pkg_resources.py", line 1017, in get_cache_path
    Resource providers should call this method ONLY after successfully
  File "build/bdist.macosx-10.8-x86_64/egg/pkg_resources.py", line 997, in extraction_error

pkg_resources.ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg
cache:

  [Errno 13] Permission denied: '/Users/xxx/.python-eggs/cx_Oracle-5.1.3-py2.7-macosx-10.8-x86_64.egg-tmp'

The Python egg cache directory is currently set to:

  /Users/xxx/.python-eggs

Perhaps your account does not have write access to this directory?  You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.

现在我不知道该怎么做。 Python 2.7.8,OSX 10.8.5

1 个答案:

答案 0 :(得分:0)

目标目录的UNIX文件权限和所有权不正确。很可能你已经以root身份安装了东西,使这些目录成为root用户。

Do not install packages as root in Python,除非你真的知道自己在做什么。

Use UNIX chmod and chown commands to fix directory permissions

...或者用sudo删除目录,然后在没有sudo的情况下重新安装包:

sudo rm -rf /Users/xxx/.python-eggs/
相关问题