问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/53406638/importerror-cannot-import-name-etree-on-python-3-6