Python spacy 模块无法在 Apache 上运行

发布于 2025-01-12 01:18:25 字数 1295 浏览 1 评论 0原文

我有一个在 Windows 中的 Apache24 上运行的 Django 应用程序。我正在使用Python 3.9.5。该应用程序运行良好。但是,在安装 spacy 模块并将其导入到 Python 文件中(如下所示)后,

import spacy

应用程序挂起并且 Apache 不再响应。 spacy 模块与 Django 的服务器(python manage.py runserver)配合良好,

我的设置很好。但如果您想知道,这里有一些。

在 settings.py 文件中:

ALLOWED_HOSTS = ['localhost']

在 C:\Apache24\conf\httpd.conf 文件中

WSGIApplicationGroup %{GLOBAL}

LoadFile "c:/users/administrator/appdata/local/programs/python/python39/python39.dll"
LoadModule wsgi_module "c:/users/administrator/appdata/local/programs/python/python39/lib/site-packages/mod_wsgi/server/mod_wsgi.cp39-win_amd64.pyd"

WSGIScriptAlias / "C:/Users/Administrator/Documents/myproject/myproject/wsgi.py"
WSGIPythonHome "c:/users/administrator/appdata/local/programs/python/python39"
WSGIPythonPath "C:/Users/Administrator/Documents/myproject/"

Alias /static C:/Users/Administrator/Documents/myproject/static

<Directory C:/Users/Administrator/Documents/myproject/static>
    Require all granted
</Directory>

<Directory C:/Users/Administrator/Documents/myproject/myproject/>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

知道为什么 spacy 模块在 Apache 服务器上不起作用以及如何修复它吗?

I have a Django application running on Apache24 in Windows. I am using Python 3.9.5. The application works fine. But after installing the spacy module and importing it on a Python file as follows,

import spacy

the application is hanging and the Apache no longer responses. The spacy module works fine with Django's server (python manage.py runserver)

My settings are fine. But in case you wonder, here are some of them.

In the settings.py file:

ALLOWED_HOSTS = ['localhost']

In the C:\Apache24\conf\httpd.conf file

WSGIApplicationGroup %{GLOBAL}

LoadFile "c:/users/administrator/appdata/local/programs/python/python39/python39.dll"
LoadModule wsgi_module "c:/users/administrator/appdata/local/programs/python/python39/lib/site-packages/mod_wsgi/server/mod_wsgi.cp39-win_amd64.pyd"

WSGIScriptAlias / "C:/Users/Administrator/Documents/myproject/myproject/wsgi.py"
WSGIPythonHome "c:/users/administrator/appdata/local/programs/python/python39"
WSGIPythonPath "C:/Users/Administrator/Documents/myproject/"

Alias /static C:/Users/Administrator/Documents/myproject/static

<Directory C:/Users/Administrator/Documents/myproject/static>
    Require all granted
</Directory>

<Directory C:/Users/Administrator/Documents/myproject/myproject/>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

Any idea why the spacy module doesn't work on the Apache server and how to fix it?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文