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來設置該文件,但不能徹底解問題,具體解決方案,請看下篇隨筆。