本文介绍了在 Windows7 下安装 Scrapy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I try to install Scrapy using easy install. I installed Cython and it seems to work, I installed libxml2 form http://www.lfd.uci.edu/~gohlke/pythonlibs/ I changed cygwinccompiler following this post scrapy installation error I still got an error and don't know what to do next. Also I don't know why there is that it is Building without Cython I have Windows 7 32-bit and 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

推荐答案

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

Not sure if you have solved it already. I ran into this problem today and here is how I solved it, grab the lxml binary directly: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

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

and pip install Scrapy somehow ignores the fact that you have it installed and tries to build again, so it will fail. However, in the directory where you run pip install there will be a 'build' directory, find 'Scrapy\setup.py' there.

现在在文件底部找到:

setup_args['install_requires'] = ...

setup_args['install_requires'] = ...

并删除 lxml 和 pyopenssl(如果您在 Windows 上工作,您很可能需要直接安装二进制文件,顺便说一句,可以在这里找到:http://slproweb.com/products/Win32OpenSSL.html)

and remove lxml and pyopenssl (you will most likely need to install the binary directly if you are working on windows, which btw can be found here: http://slproweb.com/products/Win32OpenSSL.html)

从同一目录再次运行 pip install Scrapy,你应该很高兴.

run pip install Scrapy again from the same directory and you should be good to go.

这篇关于在 Windows7 下安装 Scrapy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 15:59