2016-01-16 22 views
26
  1. これはどのように解決できますか?
  2. は、私は、Python 3.5.1がvirtualenvの
  3. ソースコードは、私の友人のコンピュータマシン上でうまく動作することにより、仮想envirementを作成し使用

エラー:AttributeError:モジュール 'html.parser'に 'HTMLParseError'属性がありません

Traceback (most recent call last): 
    File "manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 
    File "A:\Python3.5\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line 
    utility.execute() 
    File "A:\Python3.5\lib\site-packages\django\core\management\__init__.py", line 354, in execute 
    django.setup() 
    File "A:\Python3.5\lib\site-packages\django\__init__.py", line 18, in setup 
    from django.utils.log import configure_logging 
    File "A:\Python3.5\lib\site-packages\django\utils\log.py", line 13, in <module> 
    from django.views.debug import ExceptionReporter, get_exception_reporter_filter 
    File "A:\Python3.5\lib\site-packages\django\views\debug.py", line 10, in <module> 
    from django.http import (HttpResponse, HttpResponseServerError, 
    File "A:\Python3.5\lib\site-packages\django\http\__init__.py", line 4, in <module> 
    from django.http.response import (
    File "A:\Python3.5\lib\site-packages\django\http\response.py", line 13, in <module> 
    from django.core.serializers.json import DjangoJSONEncoder 
    File "A:\Python3.5\lib\site-packages\django\core\serializers\__init__.py", line 23, in <module> 
    from django.core.serializers.base import SerializerDoesNotExist 
    File "A:\Python3.5\lib\site-packages\django\core\serializers\base.py", line 6, in <module> 
    from django.db import models 
    File "A:\Python3.5\lib\site-packages\django\db\models\__init__.py", line 6, in <module> 
    from django.db.models.query import Q, QuerySet, Prefetch # NOQA 
    File "A:\Python3.5\lib\site-packages\django\db\models\query.py", line 13, in <module> 
    from django.db.models.fields import AutoField, Empty 
    File "A:\Python3.5\lib\site-packages\django\db\models\fields\__init__.py", line 18, in <module> 
    from django import forms 
    File "A:\Python3.5\lib\site-packages\django\forms\__init__.py", line 6, in <module> 
    from django.forms.fields import * # NOQA 
    File "A:\Python3.5\lib\site-packages\django\forms\fields.py", line 18, in <module> 
    from django.forms.utils import from_current_timezone, to_current_timezone 
    File "A:\Python3.5\lib\site-packages\django\forms\utils.py", line 15, in <module> 
    from django.utils.html import format_html, format_html_join, escape 
    File "A:\Python3.5\lib\site-packages\django\utils\html.py", line 16, in <module> 
    from .html_parser import HTMLParser, HTMLParseError 
    File "A:\Python3.5\lib\site-packages\django\utils\html_parser.py", line 12, in <module> 
    HTMLParseError = _html_parser.HTMLParseError 
AttributeError: module 'html.parser' has no attribute 'HTMLParseError' 
+1

あなたの友人があなたと同じバージョンを使用していますか? – Sayse

+2

そのエラーメッセージを検索するとかなりの結果が得られます。実際に調査を行ったことがありますか? – jonrsharpe

+0

あなたはどのバージョンのDjangoを使用していますか? –

答えて

12

私はちょうど同じを持っていますここでエラー。私のマシンにインストールされているDjangoのバージョンは1.7です。

Django 1.8。*へのアップグレードは私の問題を解決しました。

+0

私のdjangoのバージョンは1.8.7です.tent.txtでvituralenvでインストールしました。 – HyperZhang

+0

トレースバックを読んでも、virtualenvでプロジェクトを実行しているようには見えません。あなたはそれが有効になっているのですか? – ppalacios

+0

私が従っていたチュートリアルにはバージョン1.7.1がインストールされていましたが、同じ問題が発生しました。 1.8.8にアップグレードすることをお勧めしました。問題は解決しました。ありがとうございました! – heavyweight

23

このエラーが発生したhereあなたが読むことができると...あなたは何ができるか

because HTMLParseError is deprecated from Python 3.3 onwards and removed in Python 3.5.

は、あなたのPythonのバージョンをダウングレードしたり、Djangoのバージョンをアップグレードです。あなたがpip3

を使用している場合:

sudo pip3 install django --upgrade 

pipの場合:

+0

"ここ"のリンクはもう利用できません。 –

+1

ありがとう@JoeJリンクの参照を更新しました。 – mazulo

2

あなたのジャンゴ使用して、次のコマンドをアップグレードすることができ

sudo pip install django --upgrade 
関連する問題