修改 ModPython 下 PYTHON_EGG_CACHE 報錯

環境:Linux Apache Python(mod_python)

換了一臺新機器,沒有配置Mod_Python了,在一些應用裏import MySQLdb出現了下面錯誤:

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.

解決辦法有兩種:

1.設置PYTHON_EGG_CACHE環境變量

$ SetEnv PYTHON_EGG_CACHE /tmp/aaa/

目錄權限注意要是apache用戶,或者簡單點就777

2.把egg格式轉成目錄

$ cd /python-path/site-packages/

$ mv MySQL_python-1.2.3c1-py2.5-linux-x86_64.egg foo.zip

$ mkdir MySQL_python-1.2.3c1-py2.5-linux-x86_64.egg

$ cd MySQL_python-1.2.3c1-py2.5-linux-x86_64.egg

$ unzip ../foo.zip

$ rm ../foo.zip
發佈了44 篇原創文章 · 獲贊 3 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章