我似乎无法让WeasyPrint在使用python3.4或3.5的Windows上运行。有人能做到吗?上没有论坛weasyprint.org网站IRC频道也死了。在
我已经能够同时使用python3.4.3和3.5.1进行安装。我遵循了这里的指导方针[1]。我还注意到WeasyPrint的站点声称它应该与python2.6+或3.1+一起工作。在
当我安装Python 3.4.3并打开Python shell并简单地“import weasyprint”时,我得到以下信息:C:\Python34>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import weasyprint
Traceback (most recent call last):
File "", line 1, in
File "C:\Python34\lib\site-packages\weasyprint\__init__.py", line 337, in
from .html import find_base_url, HTML5_UA_STYLESHEET, get_html_metadata # noqa
File "C:\Python34\lib\site-packages\weasyprint\html.py", line 41, in
HTML5_UA_STYLESHEET = CSS(filename=os.path.join(root, 'css', 'html5_ua.css'))
File "C:\Python34\lib\site-packages\weasyprint\__init__.py", line 224, in __init__
with result as (source_type, source, base_url, protocol_encoding):
File "C:\Python34\lib\contextlib.py", line 59, in __enter__
return next(self.gen)
File "C:\Python34\lib\site-packages\weasyprint\__init__.py", line 294, in _select_source
base_url = path2url(filename)
File "C:\Python34\lib\site-packages\weasyprint\urls.py", line 87, in path2url
path = pathname2url(path)
File "C:\Python34\lib\nturl2path.py", line 46, in pathname2url
if not ':' in p:
TypeError: 'str' does not support the buffer interface
>>>
在python3.5.1中导入时,我得到了类似的回溯,除了最后一个TypeError是:
^{pr2}$