【问题标题】:How to setup up PYTHON_EGG_CACHE environment variable on Mac?如何在 Mac 上设置 PYTHON_EGG_CACHE 环境变量?
【发布时间】:2012-02-24 19:03:09
【问题描述】:

我正在尝试设置 Django 以使用 MySQL。输入localhost/mysite时出现以下错误

ExtractionError at /
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: '/Library/WebServer/.python-eggs'

The Python egg cache directory is currently set to:

  /Library/WebServer/.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_CACHE 环境变量以指向Apache 可以访问的目录。我尝试将以下内容添加到httpd.conf

SetEnv PYTHON_EGG_CACHE /var/www
<Directory /var/www>
    Order deny,allow
    Allow from all
</Directory>

也只是SetEnv PYTHON_EGG_CACHE /var/wwwbashrc,但似乎没有什么能解决问题。关于我可能做错的任何建议?

注意:www 是我创建的文件夹

【问题讨论】:

    标签: python mysql django mysql-python


    【解决方案1】:

    也可以尝试在wsgi脚本中设置egg缓存目录,

    import os
    os.environ['PYTHON_EGG_CACHE'] = '/usr/local/pylons/python-eggs'
    

    可以从这里找到 http://code.google.com/p/modwsgi/wiki/ApplicationIssues

    【讨论】:

      【解决方案2】:

      根据您之前的问题,您正在使用 WSGI。你想要WSGIPythonEggspython-eggs 选项WSGIDaemonProcess

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-01-11
        • 2020-07-16
        • 2017-08-04
        • 2012-03-07
        • 2011-10-10
        • 2015-09-07
        • 2013-03-03
        • 1970-01-01
        相关资源
        最近更新 更多