转载自:http://blog.csdn.net/heu07111121/article/details/50832999
最近尝试使用Scrapy进行数据抓取,并尝试在windows7 64位系统上安装scrapy,下面总结记录遇到两个问题和解决方法:
1、首先按照官网的说明,直接pip安装scrapy,报以下错误,提示缺少VC++9.0,报错信息有给出具体的说明和解决方法。
>>pip install scrapy
c:\users\zjn3645\appdata\local\temp\xmlXPathInit7hkp2z.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:\\Users\\zjn3645\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe‘ failed with exit status 2
4、关闭代理
默认使用代理,有些网页使用本地代理无法访问!
2016-03-09 15:18:21 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6023
2016-03-09 15:18:21 [scrapy] DEBUG: Crawled (403) <GET http://xxx.com.cn/xxx.html>
(referer: None)
2016-03-09 15:18:21 [scrapy] DEBUG: Ignoring response <403 http://xxx.com.cn/xxx.html>: HTTP status code is not handled or not allowed
关闭代理
修改settings.py如下
DOWNLOADER_MIDDLEWARES = {
‘scrapy.downloadermiddlewares.useragent.UserAgentMiddleware‘: None,
}