lamp : linux + apache + mysql + php
在近期项目中使用 linux + apache + php调用python脚本是出现以下权限问题:
build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1823, in get_resource_filename
build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1853, in _extract_resource
build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1193, in get_cache_path
build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1173, in extraction_error
pkg_resources.ExtractionError: Can't extract file(s) to egg cache
The following error occurred while trying to extract file(s) to the Python egg
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.
从打印输出来看:没有权限访问'/var/www/.python-eggs'
可以使用chmod来设置该文件,但不能彻底解问题,具体解决方案,请看下篇随笔。