Hello New to lxml. Not a sophisticated user. On an openSUSE (tumbleweed). Python (2.7.10) site packages are on a shared mount (say under /XXXX). Have done: # STATICBUILD=true pip install --target=/XXXX/opt/python/lib/python2.7/site-packages lxml Collecting lxml Using cached https://files.pythonhosted.org/packages/35/8a/5e066949f2b40caac32c7b2a77da63... Installing collected packages: lxml Successfully installed lxml-4.3.3 The python path finds the lxml package, but not the etree module.
python
Python 2.7.10 (default, Jul 31 2015, 15:45:52) [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
from lxml import etree
Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name etree
import lxml
Here is what is in the (above pip-installed) site-packages. # ls -lrt total 11056 -rw-r--r-- 1 root root 9406 Apr 29 12:15 sax.py -rw-r--r-- 1 root root 10189 Apr 29 12:15 _elementpath.py -rwxr-xr-x 1 root root 250837 Apr 29 12:15 sax.cpython-36m-x86_64-linux-gnu.so -rwxr-xr-x 1 root root 306132 Apr 29 12:15 _elementpath.cpython-36m-x86_64-linux-gnu.so -rwxr-xr-x 1 root root 6687968 Apr 29 12:15 etree.cpython-36m-x86_64-linux-gnu.so -rw-r--r-- 1 root root 230 Apr 29 12:15 usedoctest.py -rw-r--r-- 1 root root 551 Apr 29 12:15 __init__.py -rw-r--r-- 1 root root 17466 Apr 29 12:15 etree_api.h -rw-r--r-- 1 root root 7668 Apr 29 12:15 ElementInclude.py -rw-r--r-- 1 root root 7975 Apr 29 12:15 builder.py -rwxr-xr-x 1 root root 3766994 Apr 29 12:15 objectify.cpython-36m-x86_64-linux-gnu.so -rw-r--r-- 1 root root 17471 Apr 29 12:15 lxml.etree_api.h -rw-r--r-- 1 root root 3366 Apr 29 12:15 cssselect.py -rw-r--r-- 1 root root 92 Apr 29 12:15 pyclasslookup.py -rw-r--r-- 1 root root 8554 Apr 29 12:15 lxml.etree.h -rw-r--r-- 1 root root 8554 Apr 29 12:15 etree.h -rw-r--r-- 1 root root 18339 Apr 29 12:15 doctestcompare.py -rwxr-xr-x 1 root root 144548 Apr 29 12:15 builder.cpython-36m-x86_64-linux-gnu.so drwxr-xr-x 3 root root 4096 Apr 29 12:15 html drwxr-xr-x 4 root root 58 Apr 29 12:15 isoschematron drwxr-xr-x 2 root root 4096 Apr 29 12:15 __pycache__ drwxr-xr-x 6 root root 4096 Apr 29 12:15 includes What am I missing/misdoing in this install process? Thanks in advance, Elin.
Elin Klaseen schrieb am 29.04.19 um 21:37:
# STATICBUILD=true pip install --target=/XXXX/opt/python/lib/python2.7/site-packages lxml Collecting lxml Using cached https://files.pythonhosted.org/packages/35/8a/5e066949f2b40caac32c7b2a77da63...
It looks like your "pip" command uses Python 3.6. Use python2 -m pip install lxml instead, to be sure that you are installing lxml into the correct Python (2.7). Stefan
participants (2)
-
Elin Klaseen
-
Stefan Behnel