我正在尝试在Centos 6.8上安装CKAN 2.5.2
当我运行paster db init -c /etc/ckan/default/development.ini时
我得到错误
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
load_entry_point('PasteScript==2.0.2', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/script/command.py", line 102, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/script/command.py", line 141, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/script/command.py", line 236, in run
result = self.command()
File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 205, in command
self._load_config(cmd!='upgrade')
File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 142, in _load_config
conf = self._get_config()
File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 139, in _get_config
return appconfig('config:' + self.filename)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 261, in appconfig
global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 320, in _loadconfig
return loader.get_context(object_type, name, global_conf)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 454, in get_context
section)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 476, in _context_from_use
object_type, name=use, global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 406, in get_context
global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 328, in _loadegg
return loader.get_context(object_type, name, global_conf)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 620, in get_context
object_type, name=name)
File "/usr/lib/ckan/default/lib/python2.6/site-packages/paste/deploy/loadwsgi.py", line 646, in find_egg_entry_point
possible.append((entry.load(), protocol, entry.name))
File "/usr/lib/ckan/default/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/lib/ckan/default/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware.py", line 28, in <module>
from ckan.config.environment import load_environment
File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 18, in <module>
import ckan.lib.helpers as h
File "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 30, in <module>
from bleach import clean as clean_html
File "/usr/lib/ckan/default/lib/python2.6/site-packages/bleach/__init__.py", line 8, in <module>
from html5lib.sanitizer import HTMLSanitizer
ImportError: No module named sanitizer
我正在追踪wiki instructions
我坚持这一步骤,不知道如何进行。
导入模块html5lib并将其更新为最新版本。粘贴脚本在root用户的virtualenv中执行。
我也在python2.6中运行所有这些,因为Centos上是默认的。
一些其他信息
当我运行python并导入html5lib然后输入help(html5lib)时,我得到了这个
>>> import html5lib
>>> help(html5lib)
Help on package html5lib:
NAME
html5lib
FILE
/usr/lib/python2.6/site-packages/html5lib/__init__.py
DESCRIPTION
HTML parsing library based on the WHATWG "HTML5"
specification. The parser is designed to be compatible with existing
HTML found in the wild and implements well-defined error recovery that
is largely compatible with modern desktop web browsers.
Example usage:
import html5lib
f = open("my_document.html")
tree = html5lib.parse(f)
PACKAGE CONTENTS
_ihatexml
_inputstream
_tokenizer
_trie (package)
_utils
constants
filters (package)
html5parser
serializer
treeadapters (package)
treebuilders (package)
treewalkers (package)
CLASSES
__builtin__.object
html5lib.html5parser.HTMLParser
class HTMLParser(__builtin__.object)
| HTML parser. Generates a tree structure from a stream of (possibly
| malformed) HTML
|
| Methods defined here:
:
这里没有消毒剂。我需要使用特定版本的html5lib吗?
有人可以帮忙吗?
最佳答案
看来您已经安装了html5lib的2个副本。当您做了help(html5lib)时,它会显示一个副本,该副本已安装在用户的python目录(/usr/lib/python2.6/site-packages/)中,而不是已安装ckan(和漂白剂)的virtualenv(/ usr /lib/ckan/default/lib/python2.6/site-packages/)。因此,摆脱前者,以避免混乱。
是的,我认为您使用的是html5lib版本错误,因为当我提供帮助时,包装内容中列出了消毒剂。
这是正确的版本(在撰写本文时-以后请查看requirements.txt中的内容):
$ pip freeze | grep html5lib
html5lib==0.9999999
关于python - 创建数据库表时出错-CKAN,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38498590/