lxml install on windows 7 using pip and python 2.7

2020-02-17 03:07发布

问题:

When I try to upgrade lxml using pip on my windows 7 machine I get the log printed below.

When I uninstall and try to install from scratch I get the same errors. Any ideas?

Downloading/unpacking lxml from https://pypi.python.org/packages/source/l/lxml/l xml-3.2.4.tar.gz#md5=cc363499060f615aca1ec8dcc04df331 Downloading lxml-3.2.4.tar.gz (3.3MB): 3.3MB downloaded Running setup.py egg_info for package lxml Building lxml version 3.2.4. Building without Cython. ERROR: Nazwa 'xslt-config' nie jest rozpoznawana jako polecenie wewnętrzne l ub zewnętrzne, program wykonywalny lub plik wsadowy.

** make sure the development packages of libxml2 and libxslt are installed *

*

Using build configuration of libxslt
D:\software\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distrib ution option: 'bugtrack_url'
  warnings.warn(msg)

warning: no files found matching 'lxml.etree.c' under directory 'src\lxml'
warning: no files found matching 'lxml.objectify.c' under directory 'src\lxm l'
warning: no files found matching 'lxml.etree.h' under directory 'src\lxml'
warning: no files found matching 'lxml.etree_api.h' under directory 'src\lxm l'
warning: no files found matching 'etree_defs.h' under directory 'src\lxml'
warning: no files found matching '*.txt' under directory 'src\lxml\tests'
warning: no files found matching 'pubkey.asc' under directory 'doc'
warning: no files found matching 'tagpython*.png' under directory 'doc'
warning: no files found matching 'Makefile' under directory 'doc' Installing collected packages: lxml   Found existing installation:

lxml 2.3 Uninstalling lxml: Successfully uninstalled lxml Running setup.py install for lxml Building lxml version 3.2.4. Building without Cython. ERROR: Nazwa 'xslt-config' nie jest rozpoznawana jako polecenie wewnętrzne l ub zewnętrzne, program wykonywalny lub plik wsadowy.

** make sure the development packages of libxml2 and libxslt are installed *

*

Using build configuration of libxslt
building 'lxml.etree' extension
D:\software\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3  /GS- /DNDEBUG

-Ic:\users\x\appdata\local\temp\pip_build_x\lxml\src\lxml\inc ludes -ID:\software\Python27\include -ID:\software\Python27\PC /Tcsrc\lxml\lxml. etree.c /Fobuild\temp.win32-2.7\Release\src\lxml\lxml.etree.obj lxml.etree.c c:\users\x\appdata\local\temp\pip_build_x\lxml\src\lxml\includes\etree_d efs.h(9) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': N o such file or directory D:\software\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distrib ution option: 'bugtrack_url' warnings.warn(msg) error: command '"D:\software\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' fai led with exit status 2 Complete output from command D:\software\Python27\python.exe -c "import setu ptools;file='c:\users\x\appdata\local\temp\pip_build_x\lxml\setu p.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec' ))" install --record c:\users\x\appdata\local\temp\pip-pyyuss-record\install-r ecord.txt --single-version-externally-managed: Building lxml version 3.2.4.

Building without Cython.

ERROR: Nazwa 'xslt-config' nie jest rozpoznawana jako polecenie wewnętrzne lub z ewnętrzne,

program wykonywalny lub plik wsadowy.

** make sure the development packages of libxml2 and libxslt are installed **

Using build configuration of libxslt

running install

running build

running build_py

creating build

creating build\lib.win32-2.7

creating build\lib.win32-2.7\lxml

copying src\lxml\builder.py -> build\lib.win32-2.7\lxml

copying src\lxml\cssselect.py -> build\lib.win32-2.7\lxml

copying src\lxml\doctestcompare.py -> build\lib.win32-2.7\lxml

copying src\lxml\ElementInclude.py -> build\lib.win32-2.7\lxml

copying src\lxml\pyclasslookup.py -> build\lib.win32-2.7\lxml

copying src\lxml\sax.py -> build\lib.win32-2.7\lxml

copying src\lxml\usedoctest.py -> build\lib.win32-2.7\lxml

copying src\lxml_elementpath.py -> build\lib.win32-2.7\lxml

copying src\lxml__init__.py -> build\lib.win32-2.7\lxml

creating build\lib.win32-2.7\lxml\includes

copying src\lxml\includes__init__.py -> build\lib.win32-2.7\lxml\includes

creating build\lib.win32-2.7\lxml\html

copying src\lxml\html\builder.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html\clean.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html\defs.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html\diff.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html\ElementSoup.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html\formfill.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html\html5parser.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html\soupparser.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html\usedoctest.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html_diffcommand.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html_html5builder.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html_setmixin.py -> build\lib.win32-2.7\lxml\html

copying src\lxml\html__init__.py -> build\lib.win32-2.7\lxml\html

creating build\lib.win32-2.7\lxml\isoschematron

copying src\lxml\isoschematron__init__.py -> build\lib.win32-2.7\lxml\isoschema tron

copying src\lxml\lxml.etree.h -> build\lib.win32-2.7\lxml

copying src\lxml\lxml.etree_api.h -> build\lib.win32-2.7\lxml

copying src\lxml\includes\c14n.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\config.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\relaxng.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\schematron.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\tree.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\uri.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\xinclude.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\xpath.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\xslt.pxd -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\etree_defs.h -> build\lib.win32-2.7\lxml\includes

copying src\lxml\includes\lxml-version.h -> build\lib.win32-2.7\lxml\includes

creating build\lib.win32-2.7\lxml\isoschematron\resources

creating build\lib.win32-2.7\lxml\isoschematron\resources\rng

copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win 32-2.7\lxml\isoschematron\resources\rng

creating build\lib.win32-2.7\lxml\isoschematron\resources\xsl

copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-2 .7\lxml\isoschematron\resources\xsl

copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-2 .7\lxml\isoschematron\resources\xsl

creating build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xsl t1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_e xpand.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron -xslt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_inclu de.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xs lt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron _message.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schemat ron-xslt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron _skeleton_for_xslt1.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\ iso-schematron-xslt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_x slt1.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron- xslt1

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

running build_ext

building 'lxml.etree' extension

creating build\temp.win32-2.7

creating build\temp.win32-2.7\Release

creating build\temp.win32-2.7\Release\src

creating build\temp.win32-2.7\Release\src\lxml

D:\software\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS - /DNDEBUG -Ic:\users\x\appdata\local\temp\pip_build_x\lxml\src\lxml\include s -ID:\software\Python27\include -ID:\software\Python27\PC /Tcsrc\lxml\lxml.etre e.c /Fobuild\temp.win32-2.7\Release\src\lxml\lxml.etree.obj

lxml.etree.c

c:\users\x\appdata\local\temp\pip_build_x\lxml\src\lxml\includes\etree_defs. h(9) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No su ch file or directory

D:\software\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distributio n option: 'bugtrack_url'

warnings.warn(msg)

error: command '"D:\software\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2

---------------------------------------- Rolling back uninstall of lxml Cleaning up... Command D:\software\Python27\python.exe -c "import setuptools;file='c:\user s\x\appdata\local\temp\pip_build_x\lxml\setup.py';exec(compile(open(_ file_).read().replace('\r\n', '\n'), file, 'exec'))" install --record c:\u sers\x\appdata\local\temp\pip-pyyuss-record\install-record.txt --single-versio n-externally-managed failed with error code 1 in c:\users\x\appdata\local\temp \pip_build_x\lxml Traceback (most recent call last): File "D:\software\Python27\Scripts\pip-script.py", line 9, in load_entry_point('pip==1.4.1', 'console_scripts', 'pip')() File "D:\software\Python27\lib\site-packages\pip__init__.py", line 148, in ma in return command.main(args[1:], options) File "D:\software\Python27\lib\site-packages\pip\basecommand.py", line 169, in main text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xa9 in position 72: ordinal not in range(128)

回答1:

If you have a compiler installed (tested with VS C++ 2008 Express), you can simply run:

set STATICBUILD=true && pip install lxml

As pointed out on documentation, setting STATICBUILD will tell to lxml's installer to automatically download all its binary dependencies before build.

These lxml binary dependencies, that should be present when installing from source, will be downloaded and build together by the installer:

  • libxslt
  • iconv
  • zlib
  • libxml2

Bonus: It also works inside a virtualenv.



回答2:

This question is older but still pops up in google. I tried the other answers to this question and they did not work for one reason or another and I did't want to track down and install all the dependencies to compile on Windows.

I noticed on pypi some of the lxml releases offer windows wheels and others do not.

So the simplest solution for me was to specify a version that did... i.e. pip install lxml==3.6.0 since 3.6.0 offered a wheel while the newer 3.6.4 did not



回答3:

For your problem, there is a single line solution. Somehow, this is working means suppose you are doing scraping at low level then this will work.

After 8 hours of research, I found this as working nothing else

pip install lxml==3.6.0

Nothing else is required.

All things above are applicable for Windows.

Comment if some other type of problem is persisting happy to help.

Here is my success after 8 hours:



回答4:

You can do the steps from Flak's answer, or you can simply download the Windows installer, double click to launch it, and be on your way.



回答5:

These instructions are for Windows7 or Windows8 with Python2.7.

However, they should work for various versions as the releases of python and other respective prerequisites change/evolve:

  1. Install Python2.7:
    1. Download the last release of Python2.7 (currently 2.7.6) from the downloads page HERE
      • Direct link for Win32 MSI installer -> HERE
      • Direct link for Win64 MSI installer -> HERE
    2. Simply run the MSI to install python. It will register itself in the registry, and appear in Add/REmove Programs.
    3. NOTE: my instructions that follow assume that you choose to install python to the default path of C:\python27\ when asked during the Python Installation Wizard
  2. Add the C:\python27\ and C:\python27\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).
  3. (OPTIONAL) Install OpenSSL:
    1. Download Win32 OpenSSL page from HERE for your version of Windows and PC architecture
    2. Download Visual C++ 2008 redistributables for your version of Windows and PC architecture
    3. Download OpenSSL for your version of Windows and architecture (the regular version, not the light one)
    4. Add the following (depending on your architecture) directory (or wherever you insalled to) to your PATH, the same way you added C:\python27 and C:\python27\scripts above:
      • 32-bit: c:\openssl-win32\bin
      • 64-bit: c:\openssl-win64\bin
  4. Install Setuptools (get-pip.py should install Setuptools for you), but, just in case...
    1. Download ez_setup.py HERE and save it in C:\python27\scripts
    2. Run C:\python27\scripts> python ez_setup.py
  5. Install PIP
    1. Download get-pip.py from HERE and save it in C:\python27\scripts
    2. Run C:\python27\scripts> python get-pip.py
  6. Install LXML
    1. Download LXML 3.3.3 from HERE for your version of Windows and PC architecture
    2. Run the EXE file


回答6:

The FAQ's on the lxml website point to a site that has kindly created binary distributions for windows:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

the wheel can be installed using pip.

https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels

pip install lxml‑3.5.0‑cp27‑none‑win32.whl


回答7:

You need to install libxml, libxslt, libiconv and zlib in your virtual environment. You also need VS 2008, because python 2.7 is compiled against that version. I wrote a more detailed explanation here http://www.laurivan.com/install-lxml-on-windows-on-a-virtualenv/



回答8:

I have installed (VS C++ 2014 Express) Direct pip install failed but after adding following borrowed from Fernando Macedo set STATICBUILD=true && pip install lxml this worked for me in virtualenv on windows 10 with Python 3.5.2, lxml 3.6.4

    -tag cp35:
      Building lxml version 3.6.4.
      Building without Cython.
      ERROR: b"'xslt-config' is not recognized as an internal or external           command,\r\noperable program or batch file.\r\n"
      ** make sure the development packages of libxml2 and libxslt are installed **

       Using build configuration of libxslt
       running bdist_wheel
       running build
       running build_py
       creating build
       creating build\lib.win32-3.5
       creating build\lib.win32-3.5\lxml
       copying src\lxml\builder.py -> build\lib.win32-3.5\lxml
       copying src\lxml\cssselect.py -> build\lib.win32-3.5\lxml
       copying src\lxml\doctestcompare.py -> build\lib.win32-3.5\lxml
       copying src\lxml\ElementInclude.py -> build\lib.win32-3.5\lxml
       copying src\lxml\pyclasslookup.py -> build\lib.win32-3.5\lxml
       copying src\lxml\sax.py -> build\lib.win32-3.5\lxml
       copying src\lxml\usedoctest.py -> build\lib.win32-3.5\lxml
       copying src\lxml\_elementpath.py -> build\lib.win32-3.5\lxml
       copying src\lxml\__init__.py -> build\lib.win32-3.5\lxml
       creating build\lib.win32-3.5\lxml\includes
     copying src\lxml\includes\__init__.py -> build\lib.win32-3.5\lxml\includes
     creating build\lib.win32-3.5\lxml\html
     copying src\lxml\html\builder.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\clean.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\defs.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\diff.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\ElementSoup.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\formfill.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\html5parser.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\soupparser.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\usedoctest.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\_diffcommand.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\_html5builder.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\_setmixin.py -> build\lib.win32-3.5\lxml\html
     copying src\lxml\html\__init__.py -> build\lib.win32-3.5\lxml\html
     creating build\lib.win32-3.5\lxml\isoschematron
     copying src\lxml\isoschematron\__init__.py -> build\lib.win32-     3.5\lxml\isoschematron
     copying src\lxml\lxml.etree.h -> build\lib.win32-3.5\lxml
     copying src\lxml\lxml.etree_api.h -> build\lib.win32-3.5\lxml
     copying src\lxml\includes\c14n.pxd -> build\lib.win32-3.5\lxml\includes
     copying src\lxml\includes\config.pxd -> build\lib.win32-3.5\lxml\includes
     copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-3.5\lxml\includes
     copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-3.5\lxml\includes
     copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-3.5\lxml\includes
     copying src\lxml\includes\relaxng.pxd -> build\lib.win32-3.5\lxml\includes
     copying src\lxml\includes\schematron.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\tree.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\uri.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\xinclude.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\xpath.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\xslt.pxd -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\etree_defs.h -> build\lib.win32-3.5\lxml\includes
  copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.5\lxml\includes
  creating build\lib.win32-3.5\lxml\isoschematron\resources
  creating build\lib.win32-3.5\lxml\isoschematron\resources\rng
  copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win32-3.5\lxml\isoschematron\resources\rng
  creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl
  copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl
  copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl
  creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' extension
  creating build\temp.win32-3.5
  creating build\temp.win32-3.5\Release
  creating build\temp.win32-3.5\Release\src
  creating build\temp.win32-3.5\Release\src\lxml
  C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc\lxml\includes "-Ic:\program files\python35-32\include" "-Ic:\program files\python35-32\include" "-IC:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\winrt" /Tcsrc\lxml\lxml.etree.c /Fobuild\temp.win32-3.5\Release\src\lxml\lxml.etree.obj -w
  cl : Command line warning D9025 : overriding '/W3' with '/w'
  lxml.etree.c
  src\lxml\includes\etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
  Compile failed: command 'C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
  creating Users
  creating Users\DDSHARMA
  creating Users\DDSHARMA\AppData
  creating Users\DDSHARMA\AppData\Local
  creating Users\DDSHARMA\AppData\Local\Temp
  C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\winrt" /TcC:\Users\DDSHARMA\AppData\Local\Temp\xmlXPathInitsaig9hq_.c /FoUsers\DDSHARMA\AppData\Local\Temp\xmlXPathInitsaig9hq_.obj
  xmlXPathInitsaig9hq_.c
  C:\Users\DDSHARMA\AppData\Local\Temp\xmlXPathInitsaig9hq_.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
  *********************************************************************************
  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
  *********************************************************************************
  error: command 'C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml
  Running setup.py install for lxml ... error
    Complete output from command c:\users\ddsharma\documents\pymote_env\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\DDSHARMA\\AppData\\Local\\Temp\\pip-build-gtry8727\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\DDSHARMA\AppData\Local\Temp\pip-waqsvkju-record\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\ddsharma\documents\pymote_env\include\site\python3.5\lxml:
    Building lxml version 3.6.4.
    Building without Cython.
    ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
    ** make sure the development packages of libxml2 and libxslt are installed **

    Using build configuration of libxslt
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.5
    creating build\lib.win32-3.5\lxml
    copying src\lxml\builder.py -> build\lib.win32-3.5\lxml
    copying src\lxml\cssselect.py -> build\lib.win32-3.5\lxml
    copying src\lxml\doctestcompare.py -> build\lib.win32-3.5\lxml
    copying src\lxml\ElementInclude.py -> build\lib.win32-3.5\lxml
    copying src\lxml\pyclasslookup.py -> build\lib.win32-3.5\lxml
    copying src\lxml\sax.py -> build\lib.win32-3.5\lxml
    copying src\lxml\usedoctest.py -> build\lib.win32-3.5\lxml
    copying src\lxml\_elementpath.py -> build\lib.win32-3.5\lxml
    copying src\lxml\__init__.py -> build\lib.win32-3.5\lxml
    creating build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\__init__.py -> build\lib.win32-3.5\lxml\includes
    creating build\lib.win32-3.5\lxml\html
    copying src\lxml\html\builder.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\clean.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\defs.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\diff.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\ElementSoup.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\formfill.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\html5parser.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\soupparser.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\usedoctest.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_diffcommand.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_html5builder.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\_setmixin.py -> build\lib.win32-3.5\lxml\html
    copying src\lxml\html\__init__.py -> build\lib.win32-3.5\lxml\html
    creating build\lib.win32-3.5\lxml\isoschematron
    copying src\lxml\isoschematron\__init__.py -> build\lib.win32-3.5\lxml\isoschematron
    copying src\lxml\lxml.etree.h -> build\lib.win32-3.5\lxml
    copying src\lxml\lxml.etree_api.h -> build\lib.win32-3.5\lxml
    copying src\lxml\includes\c14n.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\config.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\relaxng.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\schematron.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\tree.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\uri.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xinclude.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xpath.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\xslt.pxd -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\etree_defs.h -> build\lib.win32-3.5\lxml\includes
    copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.5\lxml\includes
    creating build\lib.win32-3.5\lxml\isoschematron\resources
    creating build\lib.win32-3.5\lxml\isoschematron\resources\rng
    copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win32-3.5\lxml\isoschematron\resources\rng
    creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl
    creating build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-3.5\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    running build_ext
    building 'lxml.etree' extension
    creating build\temp.win32-3.5
    creating build\temp.win32-3.5\Release
    creating build\temp.win32-3.5\Release\src
    creating build\temp.win32-3.5\Release\src\lxml
    C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isrc\lxml\includes "-Ic:\program files\python35-32\include" "-Ic:\program files\python35-32\include" "-IC:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\winrt" /Tcsrc\lxml\lxml.etree.c /Fobuild\temp.win32-3.5\Release\src\lxml\lxml.etree.obj -w
    cl : Command line warning D9025 : overriding '/W3' with '/w'
    lxml.etree.c
    src\lxml\includes\etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
    Compile failed: command 'C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
    C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files\Windows Kits\10\include\10.0.14393.0\winrt" /TcC:\Users\DDSHARMA\AppData\Local\Temp\xmlXPathInit1y_w6myc.c /FoUsers\DDSHARMA\AppData\Local\Temp\xmlXPathInit1y_w6myc.obj
    xmlXPathInit1y_w6myc.c
    C:\Users\DDSHARMA\AppData\Local\Temp\xmlXPathInit1y_w6myc.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command 'C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\users\ddsharma\documents\pymote_env\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\DDSHARMA\\AppData\\Local\\Temp\\pip-build-gtry8727\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\DDSHARMA\AppData\Local\Temp\pip-waqsvkju-record\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\ddsharma\documents\pymote_env\include\site\python3.5\lxml" failed with error code 1 in C:\Users\DDSHARMA\AppData\Local\Temp\pip-build-gtry8727\lxml\

(pymote_env) C:\Users\DDSHARMA\Documents\pymote_env>set STATICBUILD=true && pip install lxml
Collecting lxml
  Using cached lxml-3.6.4.tar.gz
Building wheels for collected packages: lxml
  Running setup.py bdist_wheel for lxml ... done
  Stored in directory: C:\Users\DDSHARMA\AppData\Local\pip\Cache\wheels\c6\ad\ad\cd812eeb1e0e179b58d92b1e8bad7accd136f51b5d812fd495
Successfully built lxml
Installing collected packages: lxml
Successfully installed lxml-3.6.4

(pymote_env) C:\Users

\DDSHARMA\Documents\pymote_env>



回答9:

just follow the official instructions lxml