2017-03-27 54 views
0
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 

下面是進口:導入錯誤:無法導入名稱HTMLCalendar

from calendar import HTMLCalendar 

class Calendar(HTMLCalendar): 
    """ 
    Extension of the HTMLCalendar. 
    """ 
+0

哪裏定義了「HTMLCalendar」? –

+0

我瞭解您面臨的問題,但總的來說,您應該提供儘可能多的信息。你能刪除與你的問題不直接相關的代碼嗎? (即巨大的錯誤信息)。 – mknull

+0

輸入終端「pip freeze」並檢查是否有模塊可用 –

回答

0

這看起來像HTMLcalendar.py沒有位於Python的搜索路徑。 您可以

import sys 
sys.path 

檢查路徑如果HTMLcalendar.py的目錄不在Python路徑可以用

sys.path.append('path') 

注意在腳本中添加:路徑將恢復正常在完成劇本之後。如果你想永久保存,你將不得不編輯PYTHONPATH環境變量。

+0

如何執行此命令,幫助我 –

+0

要使用這些命令,只需將其放在python shell中並複製粘貼即可。一般來說,你能用更多的話來解釋你的需求嗎?我很難理解你卡在哪裏。 – mknull

相關問題