I\'m trying to install lmxl
on my Windows 8.1 laptop with Python 3.4 and failing miserably.
First off, I tried the simple and obvious solution: pi
I had this issue with a requirements file that listed lxml==4.2.1. However, I was able to fix the problem by updating this to lxml==4.2.5.
First, following the comments, I downloaded the lxml-3.4.2-cp34-none-win_amd64.whl
file and tried to open it with a pip install
, but it just told me it wasn't a valid wheel file on my system or something.
Then, I downloaded the win_32
file and it worked! Maybe it's because I have an Intel processor and AMD64 is, unsurprisingly, only for AMD processors.
I also meet this problem recently. pip can't not work on .whl file. Instead of fixing this, i install it through .exe file. you can download it from here.Please choose the right version of your python. Hope this can help you.
From the distributer's website, the correct command is:
pip install lxml==3.4.4
Of course, update version number to match the latest version.
Reference: https://pypi.org/project/lxml/3.4.4/
These instructions are for Windows7 or Windows8 with Python3.4.
However, they should work for various versions as the releases of python and other respective prerequisites change/evolve:
C:\python34\
when asked during the Python Installation WizardC:\python33\
and C:\python34\scripts
folders to the system path by adding those directories to the PATH
environment variable from the Control Panel > System > Advanced System Settings link (Advanced Tab) > Environmental Variables (Button).c:\openssl-win32\bin
(or similar) directory to your PATH
, the same way you added C:\python34
and C:\python34\scripts
above.get-pip.py
should install Setuptools for you), but, just in case...
ez_setup.py
HERE and save it in C:\python34\scripts
C:\python34\scripts> python ez_setup.py
get-pip.py
from HERE and save it in C:\python34\scripts
C:\python34\scripts> python get-pip.py
LXML 3.4.4
from HERE for your version of Windows and PC architectureLooks like today in 2018, lxml
can be installed from PyPI:
C:\Users\Administrator>"c:\Program Files\Python37\python.exe" -m pip install -U pip wheel setuptools
Collecting pip
Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 3.3MB/s
Collecting wheel
Downloading https://files.pythonhosted.org/packages/5a/9b/6aebe9e2636d35d1a93772fa644c828303e1d5d124e8a88f156f42ac4b87/wheel-0.32.2-py2.py3-none-any.whl
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/96/06/c8ee69628191285ffffddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl (569kB)
100% |████████████████████████████████| 573kB 2.9MB/s
Installing collected packages: pip, wheel, setuptools
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
The script wheel.exe is installed in 'c:\Program Files\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Found existing installation: setuptools 39.0.1
Uninstalling setuptools-39.0.1:
Successfully uninstalled setuptools-39.0.1
Successfully installed pip-18.1 setuptools-40.4.3 wheel-0.32.2
C:\Users\Administrator>pip install lxml
Collecting lxml
Downloading https://files.pythonhosted.org/packages/d7/9d/1aa28aa9d293a816baec6c37328d6465b722b2ff3f4d1e93ed56e87813ee/lxml-4.2.5-cp37-cp37m-win_amd64.whl (3.6MB)
100% |████████████████████████████████| 3.6MB 1.6MB/s
Installing collected packages: lxml
Successfully installed lxml-4.2.5
C:\Users\Administrator>python
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from io import BytesIO
>>> some_file_or_file_like_object = BytesIO(b"<root>data</root>")
>>> from lxml import etree
>>> tree = etree.parse(some_file_or_file_like_object)
>>> etree.tostring(tree)
b'<root>data</root>'