PYTHON_EGG_CACHE
作者: 2hei 发表于2009年9月 1日 10:58 版权声明: 可以转载, 转载时务必以超链形式标明文章原始出处和作者信息及版权声明
http://www.2hei.net/mt/2009/09/python-egg-cache.html
在使用python写的cgi是遇到如下问题
Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 20] Not a directory: '/dev/null/.python-eggs' The Python egg cache directory is currently set to: /dev/null/.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.
分析其主要原因是启动http服务的用户没有主目录,所以系统默认给分配了/dev/null这个目录,所以当要在/dev/null/中解开egg文件时,会有错误
解决办法为设定PYTHON_EGG_CACHE变量即可,具体如下:
import os
os.environ['PYTHON_EGG_CACHE'] = '/tmp/'





发表一个评论