目标WSGI脚本无法作为Python模块加载:没有名为'pytz'的模块

问题描述 投票:0回答:1

此错误似乎很容易解决,对吧?我试着做pip3 install pytz。但是似乎仍然认为它不存在。有什么想法吗?

对于上下文,我正在遵循本指南https://mindchasers.com/dev/apache-install

这是我的error.log:

[Tue Nov 05 16:36:26.413502 2019] [wsgi:error] [pid 23202:tid 140594089387776]   mod_wsgi (pid=23202): Target WSGI script '/build/CommsApp/CommsApp/wsgi.py' cannot be loaded as Python module.
[Tue Nov 05 16:36:26.413537 2019] [wsgi:error] [pid 23202:tid 140594089387776]   mod_wsgi (pid=23202): Exception occurred processing WSGI script '/build/CommsApp/CommsApp/wsgi.py'.
[Tue Nov 05 16:36:26.413732 2019] [wsgi:error] [pid 23202:tid 140594089387776]   Traceback (most recent call last):
[Tue Nov 05 16:36:26.413800 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/CommsApp/CommsApp/wsgi.py", line 12, in <module>
[Tue Nov 05 16:36:26.413805 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.wsgi import get_wsgi_application
[Tue Nov 05 16:36:26.413811 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/wsgi.py", line 2, in <module>
[Tue Nov 05 16:36:26.413815 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.handlers.wsgi import WSGIHandler
[Tue Nov 05 16:36:26.413820 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/handlers/wsgi.py", line 8, in <module>
[Tue Nov 05 16:36:26.413824 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.handlers import base
[Tue Nov 05 16:36:26.413830 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/handlers/base.py", line 8, in <module>
[Tue Nov 05 16:36:26.413833 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.urls import get_resolver, set_urlconf
[Tue Nov 05 16:36:26.413839 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/urls/__init__.py", line 1, in <module>
[Tue Nov 05 16:36:26.413842 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from .base import (
[Tue Nov 05 16:36:26.413848 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/urls/base.py", line 8, in <module>
[Tue Nov 05 16:36:26.413851 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from .exceptions import NoReverseMatch, Resolver404
[Tue Nov 05 16:36:26.413857 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/urls/exceptions.py", line 1, in <module>
[Tue Nov 05 16:36:26.413861 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.http import Http404
[Tue Nov 05 16:36:26.413866 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/http/__init__.py", line 5, in <module>
[Tue Nov 05 16:36:26.413869 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.http.response import (
[Tue Nov 05 16:36:26.413884 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/http/response.py", line 15, in <module>
[Tue Nov 05 16:36:26.413889 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.serializers.json import DjangoJSONEncoder
[Tue Nov 05 16:36:26.413894 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/serializers/__init__.py", line 23, in <module>
[Tue Nov 05 16:36:26.413898 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.serializers.base import SerializerDoesNotExist
[Tue Nov 05 16:36:26.413903 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/serializers/base.py", line 7, in <module>
[Tue Nov 05 16:36:26.413907 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.db import models
[Tue Nov 05 16:36:26.413912 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/db/models/__init__.py", line 3, in <module>
[Tue Nov 05 16:36:26.413916 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.db.models.aggregates import *  # NOQA
[Tue Nov 05 16:36:26.413921 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/db/models/aggregates.py", line 5, in <module>
[Tue Nov 05 16:36:26.413925 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.db.models.expressions import Case, Func, Star, When
[Tue Nov 05 16:36:26.413930 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/db/models/expressions.py", line 8, in <module>
[Tue Nov 05 16:36:26.413934 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.db.models import fields
[Tue Nov 05 16:36:26.413939 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/db/models/fields/__init__.py", line 11, in <module>
[Tue Nov 05 16:36:26.413942 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django import forms
[Tue Nov 05 16:36:26.413948 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/forms/__init__.py", line 6, in <module>
[Tue Nov 05 16:36:26.413951 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.forms.boundfield import *  # NOQA
[Tue Nov 05 16:36:26.413957 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/forms/boundfield.py", line 3, in <module>
[Tue Nov 05 16:36:26.413960 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.forms.utils import flatatt, pretty_name
[Tue Nov 05 16:36:26.413966 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/forms/utils.py", line 6, in <module>
[Tue Nov 05 16:36:26.413969 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.utils import timezone
[Tue Nov 05 16:36:26.413975 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/utils/timezone.py", line 11, in <module>
[Tue Nov 05 16:36:26.413978 2019] [wsgi:error] [pid 23202:tid 140594089387776]       import pytz
[Tue Nov 05 16:36:26.413992 2019] [wsgi:error] [pid 23202:tid 140594089387776]   ModuleNotFoundError: No module named 'pytz'
python django pip apache2 wsgi
1个回答
0
投票

找到了解决方案!

我使用sudo su并以root身份运行pip3 install命令,这似乎已经解决了问题!

© www.soinside.com 2019 - 2024. All rights reserved.