Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

ubuntu 14.04 - ImportError: cannot import name 'etree' on Python 3.6

I am getting error while running "from lxml import tree" on python3.6

>>> import lxml
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'etree'

The same working on python3.4, I have tried many things to troubleshoot as below but didn't success.

python -m pip uninstall lxml
python -m pip install lxml==3.6.0

pip install -t /usr/local/lib/python3.6/dist-packages lxml==3.6.0
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just in case anybody has similar issue. I also encountered this problem using Python3.6. Just by uninstalling lxml and installing it again with pip the issue is resolved.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...