komputes
komputes

Reputation: 139

lxml xpath cannot import name etree

Using Ubuntu 14.04 following this lxml xpath tutorial https://www.youtube.com/watch?v=PgWfF-Ut0zM

Updated with this to download pip's upstream version of lxml https://stackoverflow.com/a/33089634

sudo apt-get install python-pip
pip install -U lxml
python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml
>>> page = open('/root/page1.html').read()
>>> from lxml import etree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name etree

Upvotes: 2

Views: 10156

Answers (1)

YJLO
YJLO

Reputation: 81

Installing another version of lxml solved my issue:

pip install lxml==3.6.0

Upvotes: 4

Related Questions