Python错误:命令'C:\\ Program Files(x86)\\ Microsoft Visual Studio 14.0 \\ VC \\ BIN \\ cl.exe'失败,退出状态为4

时间:2016-11-20 05:13:58

标签: python visual-studio visual-studio-2015 pip python-docx

我在安装python 3模块时遇到了一些问题。我正在尝试使用pip安装python docx:

pip install python-docx

for python 3.4,这是我得到的错误:

 error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 4

以下是完整的信息:

*C:\Python34>pip install python-docx
Collecting python-docx
  Using cached python-docx-0.8.6.tar.gz
Collecting lxml>=2.3.2 (from python-docx)
  Using cached lxml-3.6.4.tar.gz
Installing collected packages: lxml, python-docx
  Running setup.py install for lxml ... error
    Complete output from command "c:\users\sultan ahmed\appdata\local\programs\python\python35-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\SULTAN~1\\AppData\\Local\\Temp\\pip-build-9px1syzb\\lxml\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\SULTAN~1\AppData\Local\Temp\pip-ea3o7pxk-record\install-record.txt --single-version-externally-managed --compile:
    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 (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Isrc\lxml\includes "-Ic:\users\sultan ahmed\appdata\local\programs\python\python35-32\include" "-Ic:\users\sultan ahmed\appdata\local\programs\python\python35-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\atl\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\mfc\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\include" /Tcsrc\lxml\lxml.etree.c /Fobuild\temp.win32-3.5\Release\src\lxml\lxml.etree.obj -w
    fatal error C1510: Cannot load language resource clui.dll.
    Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 4
    creating Users
    creating Users\SULTAN~1
    creating Users\SULTAN~1\AppData
    creating Users\SULTAN~1\AppData\Local
    creating Users\SULTAN~1\AppData\Local\Temp
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -I/usr/include/libxml2 "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\atl\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\mfc\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\VC98\include" /TcC:\Users\SULTAN~1\AppData\Local\Temp\xmlXPathInitjiyz_drd.c /FoUsers\SULTAN~1\AppData\Local\Temp\xmlXPathInitjiyz_drd.obj
    fatal error C1510: Cannot load language resource clui.dll.
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 4

    ----------------------------------------
Command ""c:\users\sultan ahmed\appdata\local\programs\python\python35-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\SULTAN~1\\AppData\\Local\\Temp\\pip-build-9px1syzb\\lxml\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\SULTAN~1\AppData\Local\Temp\pip-ea3o7pxk-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\SULTAN~1\AppData\Local\Temp\pip-build-9px1syzb\lxml\*

之前我遇到过模块安装的其他问题,我通过安装Visual Studio C ++ 2010解决了这些问题

不过,其他模块的安装工作正常。

我的规格:Windows 10 x64

Python 3.4

1 个答案:

答案 0 :(得分:4)

最快的方法是从二进制安装程序安装lxml

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

看起来Visual Studio C编译器无法找到libxml2和/或libxslt C库,这是阻止lxml安装的常见问题,因为它依赖于两者都有。

如果你真的想从源代码构建它,那就是你想要接下来的方向,确认这两个C库的安装。但大多数人只是从二进制文件安装lxml