FastCGI模式使用spawn-fcgi运行python脚本,pycurl调用时捕获了如下异常:
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: '/root/.python-eggs'
The Python egg cache directory is currently set to:
/root/.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库中的egg文件!
1、进入site-packages目录。(找不到?whereis python一下,在lib里)
2、把需要的egg解压成目录。(以我的 pycurl-7.19.0-py2.6-linux-i686.egg 为例)
mkdir tmp
unzip pycurl-7.19.0-py2.6-linux-i686.egg -d tmp
rm -f pycurl-7.19.0-py2.6-linux-i686.egg
mv tmp pycurl-7.19.0-py2.6-linux-i686.egg
欧了,蛇蛋已煎好,慢慢享用吧:)