Scrapy使用问题整理(转载)
生活随笔
收集整理的這篇文章主要介紹了
Scrapy使用问题整理(转载)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
轉(zhuǎn)載自:http://blog.csdn.net/heu07111121/article/details/50832999 最近嘗試使用Scrapy進(jìn)行數(shù)據(jù)抓取,并嘗試在windows7 64位系統(tǒng)上安裝scrapy,下面總結(jié)記錄遇到兩個問題和解決方法: scrapy官網(wǎng)的地址為:http://scrapy.org/ 1、首先按照官網(wǎng)的說明,直接pip安裝scrapy,報以下錯誤,提示缺少VC++9.0,報錯信息有給出具體的說明和解決方法。 >>pip?install?scrapy error:?Microsoft?Visual?C++?9.0?is?required?(Unable?to?find?vcvarsall.bat).?Get?it?from?http://aka.ms/vcpython27 解決方法:直接點擊下載VCForPython27.msi,也直接訪問下面的連接https://www.microsoft.com/en-us/download/details.aspx?id=44266 2、下載并安裝VCForPython27.msi,然后再運行pip install scrapy,再次報錯,提示找不到libxml2庫。 >>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 解決方法: 使用easy_install安裝lxml,然后再次安裝pip install scrapy,成功~ >>easy_install?lxml ? 3、scrapy安裝完成,運行官網(wǎng)首頁的樣例報錯,原因是缺少pywin32 >>scrapy?runspider?myspider.py exceptions.ImportError:?No?module?named?win32api 2016-03-09?10:17:49?[twisted]?CRITICAL: 解決方法:按照官方文檔的說明安裝 Install?pywin32?from?https://sourceforge.net/projects/pywin32/files/pywin32/ 這里有詳細(xì)的說明http://doc.scrapy.org/en/latest/intro/install.html#intro-install-platform-notes pywin32有32位和64位版本, 對于64位的windows 7,如果python環(huán)境變量已經(jīng)正確安裝,pywin32安裝的時候仍然報找不到python的錯誤,嘗試pywin32的32位版本。 總結(jié):在安裝和使用新的工具之前一定要先看看官方文檔的說明,搞清楚安裝和使用的前提條件! 4、關(guān)閉代理 默認(rèn)使用代理,有些網(wǎng)頁使用本地代理無法訪問! 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 關(guān)閉代理 修改settings.py如下 DOWNLOADER_MIDDLEWARES?=?{ ????'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware':?None, }
轉(zhuǎn)載于:https://www.cnblogs.com/Devopser/p/6393699.html
總結(jié)
以上是生活随笔為你收集整理的Scrapy使用问题整理(转载)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java 调用r语言包传参数_Java与
- 下一篇: 蓝桥杯-凑算式