开发者社区> 问答> 正文

python2.7.3安装libxml2,导入import lxml.html报?报错

系统是red hat ,自带的是2.6.6版本的python,但最近需要使用scrapy需要安装2.7.3版本的
,通过yum install 安装的libxml2,安装成功后import lxml没有报错,但import lxml.html
时就报错了,报错信息如下:

import lxml.html
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/lxml/html/__init__.py", line 12, in
from lxml import etree
File "lxml.etree.pyx", line 89, in init lxml.etree (src/lxml/lxml.etree.c:140164)
TypeError: encode() argument 1 must be string without null bytes, not unicode

求各位python大神指导...

展开
收起
爱吃鱼的程序员 2020-06-23 14:36:49 657 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    看上去是安装的版本跟你的python版本不兼容

    2020-06-23 14:37:06
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载