Django CMS“没有名为 html5lib 的模块”

发布于 2024-12-10 01:33:14 字数 3248 浏览 5 评论 0原文

我有一个基本的 Django CMS 网站,安装了所有默认和推荐的模块,但是我收到错误消息...

已更新

Request Method: GET
Request URL:    http://teamdjango.lnukapps.co.uk/admin/cms/page/21/
Django Version: 1.3.1
Exception Type: ImportError
Exception Value:    
No module named html5lib
Exception Location: /usr/lib/python2.6/site-packages/django_cms-2.2-py2.6.egg/cms/utils/html.py in <module>, line 2
Python Executable:  /usr/bin/python
Python Version: 2.6.6
Python Path:    
['/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
 '/usr/lib/python2.6/site-packages/html5lib-0.90-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_classy_tags-0.3.4.1-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_mptt-0.4.2-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_sekizai-0.4.2-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_cms-2.2-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_filer-0.9a1-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_polymorphic-0.2-py2.6.egg',
 '/usr/lib/python2.6/site-packages/easy_thumbnails-1.0_alpha_18-py2.6.egg',
 '/usr/lib/python2.6/site-packages/cmsplugin_filer-0.8.0-py2.6.egg',
 '/usr/lib64/python26.zip',
 '/usr/lib64/python2.6',
 '/usr/lib64/python2.6/plat-linux2',
 '/usr/lib64/python2.6/lib-tk',
 '/usr/lib64/python2.6/lib-old',
 '/usr/lib64/python2.6/lib-dynload',
 '/usr/lib64/python2.6/site-packages',
 '/usr/lib64/python2.6/site-packages/PIL',
 '/usr/lib/python2.6/site-packages',
 '/usr/lib/python2.6/site-packages']

 Server time:   Fri, 14 Oct 2011 14:05:59 +0100

html5lib 已通过 easy_install html5lib 安装,如果我 < code>import html5lib 在默认的 Python shell 中它可以正常导入。

Python 2.6.6 (r266:84292, May 20 2011, 16:42:11)
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import html5lib
>>>

这是在带有 Python 2.6.6 的 Scientific Linux 的全新安装上进行设置的。

我正在使用 Django 1.3.1。

我的 INSTALLED_APPS 如图所示。

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    'cms',
    'mptt',
    'menus',
    'south',
    'sekizai',
    'cms.plugins.flash',
    'cms.plugins.googlemap',
    'cms.plugins.link',
    'cms.plugins.snippet',
    'cms.plugins.text',
    'cms.plugins.twitter',
    'filer',
    'cmsplugin_filer_file',
    'cmsplugin_filer_folder',
    'cmsplugin_filer_image',
    'cmsplugin_filer_teaser',
    'cmsplugin_filer_video',
    # 'reversion',
)

我的问题(如果现在还不明显;))是为什么导入 html5lib 时出现问题以及如何修复它。

更新 1

@matt-williamson 谢谢,这是 html5lib 文件信息

>>> html5lib.__file__
'/usr/lib/python2.6/site-packages/html5lib-0.90-py2.6.egg/html5lib/__init__.pyc'

,我已经更新了 Django 错误以提供更多错误页面。正如您所看到的,Python 路径包括 /usr/lib/python2.6/site-packages/html5lib-0.90-py2.6.egg 这表明我应该能够找到它。

I have a basic Django CMS site installed with all the default and recommended modules however I recieve and error saying...

Updated

Request Method: GET
Request URL:    http://teamdjango.lnukapps.co.uk/admin/cms/page/21/
Django Version: 1.3.1
Exception Type: ImportError
Exception Value:    
No module named html5lib
Exception Location: /usr/lib/python2.6/site-packages/django_cms-2.2-py2.6.egg/cms/utils/html.py in <module>, line 2
Python Executable:  /usr/bin/python
Python Version: 2.6.6
Python Path:    
['/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
 '/usr/lib/python2.6/site-packages/html5lib-0.90-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_classy_tags-0.3.4.1-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_mptt-0.4.2-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_sekizai-0.4.2-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_cms-2.2-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_filer-0.9a1-py2.6.egg',
 '/usr/lib/python2.6/site-packages/django_polymorphic-0.2-py2.6.egg',
 '/usr/lib/python2.6/site-packages/easy_thumbnails-1.0_alpha_18-py2.6.egg',
 '/usr/lib/python2.6/site-packages/cmsplugin_filer-0.8.0-py2.6.egg',
 '/usr/lib64/python26.zip',
 '/usr/lib64/python2.6',
 '/usr/lib64/python2.6/plat-linux2',
 '/usr/lib64/python2.6/lib-tk',
 '/usr/lib64/python2.6/lib-old',
 '/usr/lib64/python2.6/lib-dynload',
 '/usr/lib64/python2.6/site-packages',
 '/usr/lib64/python2.6/site-packages/PIL',
 '/usr/lib/python2.6/site-packages',
 '/usr/lib/python2.6/site-packages']

 Server time:   Fri, 14 Oct 2011 14:05:59 +0100

html5lib has been installed via easy_install html5lib and if I import html5lib in a default Python shell it imports fine.

Python 2.6.6 (r266:84292, May 20 2011, 16:42:11)
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import html5lib
>>>

This is set up on a clean install of Scientific Linux with Python 2.6.6.

I am using Django 1.3.1.

My INSTALLED_APPS is as shown.

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    'cms',
    'mptt',
    'menus',
    'south',
    'sekizai',
    'cms.plugins.flash',
    'cms.plugins.googlemap',
    'cms.plugins.link',
    'cms.plugins.snippet',
    'cms.plugins.text',
    'cms.plugins.twitter',
    'filer',
    'cmsplugin_filer_file',
    'cmsplugin_filer_folder',
    'cmsplugin_filer_image',
    'cmsplugin_filer_teaser',
    'cmsplugin_filer_video',
    # 'reversion',
)

My question (if it isn't obvious by now ;) ) is why is there a problem importing html5lib and how can I fix it.

Update 1

@matt-williamson
Thanks, here is the html5lib file info

>>> html5lib.__file__
'/usr/lib/python2.6/site-packages/html5lib-0.90-py2.6.egg/html5lib/__init__.pyc'

I have updated the Django error to give more of the error page. As you can see the Python Path includes /usr/lib/python2.6/site-packages/html5lib-0.90-py2.6.egg which suggests to me it should be able to find it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏有森光若流苏 2024-12-17 01:33:14

要么安装了两个版本的 python,要么需要设置 python 路径。

获取模块安装到

>>> import html5lib
>>> html5lib.__file__

'/Library/Python/2.7/site-packages/html5lib-0.90-py2.7.egg/html5lib/init.pyc' 的

路径
<块引用>
<块引用>

^D


设置 PYTHONPATH 环境变量。

export PYTHONPATH="$PYTHONPATH:/Library/Python/2.7/site-packages/"
python manage.py runserver

Either you have two versions of python installed or you need to set your python path.

Get the path the module is installed to

>>> import html5lib
>>> html5lib.__file__

'/Library/Python/2.7/site-packages/html5lib-0.90-py2.7.egg/html5lib/init.pyc'

^D

Set the PYTHONPATH environment variabled.

export PYTHONPATH="$PYTHONPATH:/Library/Python/2.7/site-packages/"
python manage.py runserver
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文