File "managers.py", line 2, in <module> from django.contrib.sites.models import Site
File "/usr/lib/python2.7/dist-packages/django/contrib/sites/models.py", line 7, in <module> from django.db import models
File "/usr/lib/python2.7/dist-packages/django/db/models/__init__.py", line 6, in <module> from django.db.models.query import Q, QuerySet, Prefetch # NOQA
File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 16, in <module> from django.db.models import sql
File "/usr/lib/python2.7/dist-packages/django/db/models/sql/__init__.py", line 2, in <module> from django.db.models.sql.subqueries import * # NOQA
File "/usr/lib/python2.7/dist-packages/django/db/models/sql/subqueries.py", line 9, in <module> from django.db.models.sql.query import Query
File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 17, in <module> from django.db.models.aggregates import Count
File "/usr/lib/python2.7/dist-packages/django/db/models/aggregates.py", line 5, in <module> from django.db.models.expressions import Func, Star File "/usr/lib/python2.7/dist-packages/django/db/models/expressions.py", line 7, in <module> from django.db.models import fields
File "/usr/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", line 19, in <module> from django import forms
File "/usr/lib/python2.7/dist-packages/django/forms/__init__.py", line 6, in <module> from django.forms.fields import * # NOQA
File "/usr/lib/python2.7/dist-packages/django/forms/fields.py", line 21, in <module> from django.forms.utils import from_current_timezone, to_current_timezone
File "/usr/lib/python2.7/dist-packages/django/forms/utils.py", line 12, in <module> from django.utils.html import escape, format_html, format_html_join, html_safe
File "/usr/lib/python2.7/dist-packages/django/utils/html.py", line 13, in <module> from django.utils.http import RFC3986_GENDELIMS, RFC3986_SUBDELIMS
File "/usr/lib/python2.7/dist-packages/django/utils/http.py", line 4, in <module> import calendar
File "/home/homa/Desktop/zinnia/calendar.py", line 4, in <module> from calendar import HTMLCalendar ImportError: cannot import name HTMLCalendar
以下是导入:
from calendar import HTMLCalendar
class Calendar(HTMLCalendar):
"""
Extension of the HTMLCalendar.
"""
答案 0 :(得分:0)
这看起来HTMLcalendar.py不在python的搜索路径中。 您可以使用
检查路径return *this;
如果HTMLcalendar.py的目录不在python路径中,您可以使用
将其添加到脚本中import sys
sys.path
注意:完成脚本后,路径将恢复正常。如果要使其永久化,则必须编辑PYTHONPATH环境变量。