如何在Mac上设置PYTHON_EGG_CACHE环境变量? [英] How to setup up PYTHON_EGG_CACHE environment variable on Mac?

查看:262
本文介绍了如何在Mac上设置PYTHON_EGG_CACHE环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置Django来使用MySQL。当我输入 localhost / mysite

 时,我收到以下错误/ 
中的ExtractionError无法将文件提取到egg cache

尝试将文件解压缩到Python egg
缓存时出现以下错误:

[Errno 13]权限被拒绝:'/Library/WebServer/.python-eggs'

Python egg缓存目录目前设置为:

/Library/WebServer/.python-eggs

也许您的帐户没有这个目录的写入权限?您可以
通过将PYTHON_EGG_CACHE环境
变量设置为指向可访问的目录来更改缓存目录。

从错误消息中我知道我必须更改 PYTHON_EGG_CACHE 环境变量指向Apache可以访问的目录。我尝试将以下内容添加到 httpd.conf

  SetEnv PYTHON_EGG_CACHE / var / www 
< Directory / var / www>
订单拒绝,允许
允许从所有
< / Directory>

还只是 SetEnv PYTHON_EGG_CACHE / var / www bashrc ,但似乎没有解决问题。关于我可能做的错误的任何建议?



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

解决方案

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

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

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


I am trying to setup Django to use MySQL. I am getting the following error when I type in 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.

From the error message I know that I have to change the PYTHON_EGG_CACHE environment variable to point to a directory that Apache can access. I tried adding the following to httpd.conf

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

and also just SetEnv PYTHON_EGG_CACHE /var/www to bashrc, but nothing seems to resolve the problem. Any suggestions on what I might be doing wrong?

Note: www is a folder that I created

解决方案

Also might try to set the egg cache directory in the wsgi script,

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

as can be found from here http://code.google.com/p/modwsgi/wiki/ApplicationIssues

这篇关于如何在Mac上设置PYTHON_EGG_CACHE环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆