当前位置: 首页 > python > 正文

PYTHON_EGG_CACHE

在使用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/’

 

本文固定链接: http://2hei.net/python_egg_cache.html | 2hei's site

该日志由 2hei 于2009年09月01日发表在 python 分类下,
原创文章转载请注明: PYTHON_EGG_CACHE | 2hei's site
关键字:

报歉!评论已关闭.