【问题标题】:pkg_resources.ExtractionError: Can't extract file(s) to egg cache: [Errno 13] Permission denied:pkg_resources.ExtractionError:无法将文件提取到蛋缓存:[Errno 13] 权限被拒绝:
【发布时间】:2014-10-19 00:07:09
【问题描述】:

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

我想卸载 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

【问题讨论】:

  • "也许您的帐户没有对该目录的写入权限?" /Users/xxx, /Users/xxx/.python-eggs 的权限是什么?您在哪个身份下运行命令?例如,您是否尝试将PYTHON_EGG_CACHE 设置为/tmp
  • 很抱歉,我对这个领域知之甚少,并不真正了解您的问题和/或如何回答这些问题。对于它的价值,sudo 似乎消除了这个错误。
  • 请学习如何使用 virtualenv 来管理你的 Python 鸡蛋:opensourcehacker.com/2012/09/16/…
  • 这一切都在 virtualenv 中。我很久以前就惨痛地吸取了教训。

标签: python pip setuptools easy-install


【解决方案1】:

目标目录的 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/

【讨论】:

  • 我没有使用 sudo 安装或删除软件包;我的意思是当我使用 sudo 运行脚本时,我没有收到此错误消息。
  • 哎呀,这是个谎言。我做到了。但它在 virtualenv 中,使用 easy_install。
猜你喜欢
  • 2021-05-01
  • 1970-01-01
  • 2017-04-20
  • 2011-06-11
  • 2014-07-15
  • 2015-07-17
  • 2016-07-25
  • 2013-06-12
  • 2016-05-07
相关资源
最近更新 更多