在Windows7下安装Scrapy

时间:2012-11-04 01:29:30

标签: python scrapy

我尝试使用简易安装来安装Scrapy。我安装了Cython,它似乎工作,我安装了libxml2表格http://www.lfd.uci.edu/~gohlke/pythonlibs/我在scrapy installation error之后更改了cygwinccompiler我仍然遇到错误,不知道下一步该做什么。另外我不知道为什么它是Building without Cython我有Windows 7 32位和Python 2.7

C:\Users\t>easy_install -U Scrapy
Searching for Scrapy
Reading http://pypi.python.org/simple/Scrapy/
Reading http://scrapy.org
Best match: scrapy 0.16.1
Processing scrapy-0.16.1-py2.7.egg
scrapy 0.16.1 is already the active version in easy-install.pth
Installing scrapy script to C:\Python27\Scripts
Installing scrapy.bat script to C:\Python27\Scripts

Using c:\python27\lib\site-packages\scrapy-0.16.1-py2.7.egg
Processing dependencies for Scrapy
Searching for lxml
Reading http://pypi.python.org/simple/lxml/
Reading http://codespeak.net/lxml
Best match: lxml 3.0.1
Downloading http://lxml.de/files/lxml-3.0.1.tgz
Processing lxml-3.0.1.tgz
Running lxml-3.0.1\setup.py -q bdist_egg --dist-dir c:\users\t\appdata\lo
cal\temp\easy_install-7mgdch\lxml-3.0.1\egg-dist-tmp-686xm8
Building lxml version 3.0.1.
Building without Cython.
ERROR: 'xslt-config' is not recognized as an internal or external command,
operable program or batch file.

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

Using build configuration of libxslt
warning: no files found matching '*.txt' under directory 'src\lxml\tests'
In file included from src\lxml\lxml.etree.c:254:0:
c:\users\t\appdata\local\temp\easy_install-7mgdch\lxml-3.0.1\src\lxml\inc
ludes/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or direc
tory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1

2 个答案:

答案 0 :(得分:4)

不确定你是否已经解决了。我今天遇到了这个问题,这就是我解决它的方法,直接获取lxml二进制文件:http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

和pip install Scrapy以某种方式忽略了你安装它并再次尝试构建的事实,因此它将失败。但是,在运行pip install的目录中,将有一个'build'目录,在那里找到'Scrapy \ setup.py'。

现在找到文件的底部:

setup_args ['install_requires'] = ...

并删除lxml和pyopenssl(如果你正在使用windows,你很可能需要直接安装二进制文件,可以在这里找到顺便说一下:http://slproweb.com/products/Win32OpenSSL.html

从同一目录再次运行pip install Scrapy,你应该好好去。

答案 1 :(得分:0)

我遇到了同样的问题(Windows 10,Python 2.7.12),这对我有用。     我使用“pip install scrapy”而不是“easy_install”。如果你没有为2.7安装pip,这里是official documentation。     如果仍然无效,您可以尝试按照manual installation directions

进行操作