下载scrapy时出错,lxml错误

时间:2015-07-24 21:42:26

标签: python scrapy lxml

  Failed building wheel for lxml
Failed to build lxml
Installing collected packages: lxml, scrapy
  Running setup.py install for lxml
    Complete output from command C:\Python34\python.exe -c "import setuptools, 
tokenize;__file__='C:\\Users\\Family\\AppData\\Local\\Temp\\pip-build-i6gpylsx\\
lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().
replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Family\AppData
\Local\Temp\pip-jggq15oq-record\install-record.txt --single-version-externally-managed --compile:
    Building lxml version 3.4.4.
    Building without Cython.
    ERROR: b'xslt-config \x84r inte ett internt kommando, externt kommando,\r\nprogram eller kommandofil.\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
    copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.4\lxml\includes
    running build_ext
    building 'lxml.etree' extension
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo
 /Ox /MD /W3 /GS- /DNDEBUG -IC:\Users\Family\AppData\Local\Temp\pip-build-i6gpyl
sx\lxml\src\lxml\includes -IC:\Python34\include -IC:\Python34\include /Tcsrc\lxml\
lxml.etree.c /Fobuild\temp.win32-3.4\Release\src\lxml\lxml.etree.obj -w
    cl : Command line warning D9025 : overriding '/W3' with '/w'
    lxml.etree.c
    C:\Users\Family\AppData\Local\Temp\pip-build-i6gpylsx\lxml\src\lxml\includes\etree_defs.h(14) :
        fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
    C:\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Python34\python.exe -c "import setuptools, tokenize;
__file__='C:\\Users\\Family\\AppData\\Local\\Temp\\pip-build-i6gpylsx\\lxml\\setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record C:\Users\Family\AppData\Local\Temp\pip-jggq15oq
-record\install-record.txt --single-version-externally-managed --compile" failed
 with error code 1 in C:\Users\Family\AppData\Local\Temp\pip-build-i6gpylsx\lxml

我在64位计算机上安装了Python 3.4。在堆栈溢出上搜索了很多,没有任何帮助我。我不知道什么是错的,你知道任何解决方案吗?

1 个答案:

答案 0 :(得分:0)

Scrapy当前不适用于Python 3,但是有一些计划(甚至正在进行中)来执行此端口。因此,我建议您也将Python 2.7安装到您的计算机上,并在那里安装所需的库。

对于lxml和其他库,有一些非官方的窗口,您可以查看here

有时您需要下载并安装一些免费的Visual Studio来获取Windows机器上的库,这些库可以编译lxml。您可以在SO here上找到相关问题。