什么是Python鸡蛋缓存(PYTHON_EGG_CACHE)? [英] What is the Python egg cache (PYTHON_EGG_CACHE)?

查看:166
本文介绍了什么是Python鸡蛋缓存(PYTHON_EGG_CACHE)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在开发机器上从Python 2.6.1升级到2.6.4,并且在启动python脚本时显示以下消息:

I've just upgraded from Python 2.6.1 to 2.6.4 on my development machine and upon starting a python script was presented with the following message:

无法将文件提取到Egg缓存

Can't extract file(s) to egg cache

以下错误发生在 尝试将文件提取到 Python鸡蛋缓存:

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

[Errno 13]权限被拒绝: '/var/www/.python-eggs'

[Errno 13] Permission denied: '/var/www/.python-eggs'

Python鸡蛋缓存目录为 当前设置为:

The Python egg cache directory is currently set to:

/var/www/.python-eggs

/var/www/.python-eggs

也许您的帐户没有 对此目录有写权限?你 可以通过更改缓存目录 设置PYTHON_EGG_CACHE 环境变量指向 可访问的目录.

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文档,所以我对将目录放在何处以及用于什么目的的最佳做法感到有些茫然.

There isn't anything in the python docs so I'm at a bit of a loss regarding best-practices on where to put this directory and what it's used for.

有人可以解释什么是Python卵缓存吗?

Can someone explain what the Python egg cache is?

还可以解释为什么/与Python用于存储鸡蛋的site-packages目录不同(据我所知)吗?

Also, can you explain why/how it is different to the site-packages directory Python uses to store eggs (as I understand it)?

推荐答案

从我的调查中可以发现,有些鸡蛋被打包为zip文件,并以此形式保存在Python的site-packages目录中.

From my investigations it turns out that some eggs are packaged as zip files, and are saved as such in Python's site-packages directory.

这些压缩的鸡蛋必须先解压缩才能执行,因此应扩展到PYTHON_EGG_CACHE目录,默认情况下为~/.python-eggs(位于用户的主目录中).如果不存在,则在尝试运行应用程序时会引起问题.

These zipped eggs need to be unzipped before they can be executed, so are expanded into the PYTHON_EGG_CACHE directory which by default is ~/.python-eggs (located in the user's home directory). If this doesn't exist it causes problems when trying to run applications.

有许多修复程序:

  1. 在用户的主目录中创建一个.python-eggs目录,并使该目录对用户可写.
  2. 创建一个用于解压缩的全局目录(例如/tmp/python-eggs),并将环境变量PYTHON_EGG_CACHE设置为此目录.
  3. 在安装时使用easy_install时使用-Z开关解压缩软件包.
  1. Create a .python-eggs directory in the user's home directory and make it writable for the user.
  2. Create a global directory for unzipping (eg. /tmp/python-eggs) and set the environment variable PYTHON_EGG_CACHE to this directory.
  3. Use the -Z switch when using easy_install to unzip the package when installing.

这篇关于什么是Python鸡蛋缓存(PYTHON_EGG_CACHE)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆