如何在Mac上设置PYTHON_EGG_CACHE环境变量?

发布于 2025-01-01 14:09:55 字数 1008 浏览 1 评论 0 原文

我正在尝试设置 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/www 添加到 bashrc 中,但似乎没有任何方法可以解决问题。关于我可能做错了什么有什么建议吗?

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

翻身的咸鱼 2025-01-08 14:09:55

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

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

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

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

归途 2025-01-08 14:09:55

根据您之前的问题,您正在使用 WSGI。您需要 WSGIPythonEggs 选项rel="nofollow">WSGIDaemonProcess

Based on your previous question, you're using WSGI. You want WSGIPythonEggs or the python-eggs option for WSGIDaemonProcess.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文