怎么在html中引入一个另一个模块,如何在djang中使用HTMLParser的另一个模块位置...

我出现了HTMLParser的错误,

终端显示:from django.utils.html import format_html, format_html_join, escape

File "/usr/local/lib/python3.5/dist-packages/django/utils/html.py", line 16, in

from .html_parser import HTMLParser, HTMLParseError

File "/usr/local/lib/python3.5/dist-packages/django/utils/html_parser.py", line 12, in

HTMLParseError = _html_parser.HTMLParseError

AttributeError: module 'html.parser' has no attribute 'HTMLParseError'

Python 3.5

丹戈1.7.7

使用pip3

根据社区的说法,他们说在python3.5版本上,在我这个旧的应用程序上,HTML解析器被删除了。。在

我该怎么办:-用另一个类似的替换HTMLParser,那怎么办???或

降级python版本我已经尝试过了,但它默认采用lib->/usr/lib/python3.5如何更改此路径

请帮忙。在

我的需求文件要求/通用.txt就像这样

# Core Stuff

# -------------------------------------

django>=1.7.7,<1.8

whitenoise==2.0.6

# Authentication

# -------------------------------------

django-facebook==6.0.3

PyJWT==1.4.0

# Notifications

# -------------------------------------

django-twilio-sms-2==1.0.2

hashids==1.1.0

apns==2.0.1

# Extensions

# -------------------------------------

django-extensions==1.6.1

Werkzeug==0.11.3

pytz==2015.7

django-sampledatahelper==0.3

arrow==0.7.0

requests==2.9.1

django-flat-theme==1.1.3

# Configuration

# -------------------------------------

django-sites==0.9

django-secure==1.0.1

python-dotenv==0.3.0

django-environ==0.4.0

# Models

# -------------------------------------

django-model-utils==2.4

django-uuid-upload-path==1.0.0

django-versatileimagefield==1.3

django-jsonfield==0.9.15

# Images

# -------------------------------------

Pillow==3.1.1

# For the persistance stores

# -------------------------------------

psycopg2==2.6.1

# Celery

# -------------------------------------

celery==3.1.20

# Unicode slugification

# -------------------------------------

unicode-slugify==0.1.3

django-autoslug==1.9.3

# Django Rest Framework

# -------------------------------------

djangorestframework==3.3.2

django_filter<=0.11.0 # Do not upgrade until django 1.8

Markdown>=2.3.1,<2.5 # to fix conflict with mkdocs

和要求/开发.txt在

和要求/生产.txt在

# Pro-tip: Try not to put anything here. There should be no dependency in

# production that isn't in development.

-r common.txt

# WSGI Handler

# -------------------------------------

gunicorn==19.4.5

# Caching

# -------------------------------------

django-redis==4.3.0

hiredis==0.2.0

# S3 storgage

# -------------------------------------

# boto==2.39.0

# django-storages-redux==1.3.2

# Logging

# -------------------------------------

newrelic==2.60.0.46

当我运行$ python3 manage.py makemigrations时,在安装需求之后,出现以下错误。在

Traceback (most recent call last):

File "manage.py", line 22, in

execute_from_command_line(sys.argv)

File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line

utility.execute()

File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 354, in execute

django.setup()

File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 18, in setup

from django.utils.log import configure_logging

File "/usr/local/lib/python3.5/dist-packages/django/utils/log.py", line 13, in

from django.views.debug import ExceptionReporter, get_exception_reporter_filter

File "/usr/local/lib/python3.5/dist-packages/django/views/debug.py", line 10, in

from django.http import (HttpResponse, HttpResponseServerError,

File "/usr/local/lib/python3.5/dist-packages/django/http/__init__.py", line 4, in

from django.http.response import (

File "/usr/local/lib/python3.5/dist-packages/django/http/response.py", line 13, in

from django.core.serializers.json import DjangoJSONEncoder

File "/usr/local/lib/python3.5/dist-packages/django/core/serializers/__init__.py", line 23, in

from django.core.serializers.base import SerializerDoesNotExist

File "/usr/local/lib/python3.5/dist-packages/django/core/serializers/base.py", line 6, in

from django.db import models

File "/usr/local/lib/python3.5/dist-packages/django/db/models/__init__.py", line 6, in

from django.db.models.query import Q, QuerySet, Prefetch # NOQA

File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 13, in

from django.db.models.fields import AutoField, Empty, FieldDoesNotExist

File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/__init__.py", line 18, in

from django import forms

File "/usr/local/lib/python3.5/dist-packages/django/forms/__init__.py", line 6, in

from django.forms.fields import * # NOQA

File "/usr/local/lib/python3.5/dist-packages/django/forms/fields.py", line 18, in

from django.forms.utils import from_current_timezone, to_current_timezone

File "/usr/local/lib/python3.5/dist-packages/django/forms/utils.py", line 15, in

from django.utils.html import format_html, format_html_join, escape

File "/usr/local/lib/python3.5/dist-packages/django/utils/html.py", line 16, in

from .html_parser import HTMLParser, HTMLParseError

File "/usr/local/lib/python3.5/dist-packages/django/utils/html_parser.py", line 12, in

HTMLParseError = _html_parser.HTMLParseError

AttributeError: module 'html.parser' has no attribute 'HTMLParseError'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值