拿鸡蛋python,什么是Python鸡蛋缓存(PYTHON_EGG_CACHE)?

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:

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:

'/var/www/.python-eggs'

The Python egg cache directory is

currently set to:

/var/www/.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.

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.

Can someone explain what the Python egg cache is?

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

解决方案

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.

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.

There are a number of fixes:

Create a .python-eggs directory in the user's home directory and make it writable for the user.

Create a global directory for unzipping (eg. /tmp/python-eggs) and set the environment variable PYTHON_EGG_CACHE to this directory.

Use the -Z switch when using easy_install to unzip the package when installing.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值