2014-12-07 173 views
2

我有一個問題,scrapy工作正常,直到我卸載並重新安裝。看到這當今天http://doc.scrapy.org/en/0.24/topics/ubuntu.htmlscrapy安裝在debian上

:這裏所描述 由於0.24 Debian的我加入了Ubuntu的回購我/etc/pat/sources.list.d和安裝它的時候是不可用apt-get的可用在Debian我apt-get的刪除scrapy-0.24(一個從Ubuntu的回購安裝),也易於得到安裝python-scrapy

現在,當我在這裏做一個scrapy shell www.google.fr是輸出:

2014-12-07 22:08:26+0100 [scrapy] INFO: Scrapy 0.24.2 started (bot: scrapybot) 
2014-12-07 22:08:26+0100 [scrapy] INFO: Optional features available: ssl, http11, boto, django 
2014-12-07 22:08:26+0100 [scrapy] INFO: Overridden settings: {'LOGSTATS_INTERVAL': 0} 
2014-12-07 22:08:26+0100 [scrapy] INFO: Enabled extensions: TelnetConsole, CloseSpider, WebService, CoreStats, SpiderState 
2014-12-07 22:08:26+0100 [scrapy] INFO: Enabled downloader middlewares: HttpAuthMiddleware, DownloadTimeoutMiddleware, UserAgentMiddleware, RetryMiddleware, DefaultHeadersMiddleware, MetaRefreshMiddleware, HttpCompressionMiddleware, RedirectMiddleware, CookiesMiddleware, ChunkedTransferMiddleware, DownloaderStats 
2014-12-07 22:08:26+0100 [scrapy] INFO: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware, DepthMiddleware 
2014-12-07 22:08:26+0100 [scrapy] INFO: Enabled item pipelines: 
2014-12-07 22:08:26+0100 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6023 
2014-12-07 22:08:26+0100 [scrapy] DEBUG: Web service listening on 127.0.0.1:6080 
2014-12-07 22:08:26+0100 [default] INFO: Spider opened 
2014-12-07 22:08:26+0100 [default] DEBUG: Retrying <GET file:///home/lotso/www.google.fr> (failed 1 times): [Errno 2] No such file or directory: '/home/lotso/www.google.fr' 
2014-12-07 22:08:26+0100 [default] DEBUG: Retrying <GET file:///home/lotso/www.google.fr> (failed 2 times): [Errno 2] No such file or directory: '/home/lotso/www.google.fr' 
2014-12-07 22:08:26+0100 [default] DEBUG: Gave up retrying <GET file:///home/lotso/www.google.fr> (failed 3 times): [Errno 2] No such file or directory: '/home/lotso/www.google.fr' 
Traceback (most recent call last): 
    File "/usr/bin/scrapy", line 4, in <module> 
execute() 
    File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 143, in execute 
_run_print_help(parser, _run_command, cmd, args, opts) 
    File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 89, in _run_print_help 
func(*a, **kw) 
    File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 150, in _run_command 
cmd.run(args, opts) 
    File "/usr/lib/python2.7/dist-packages/scrapy/commands/shell.py", line 50, in run 
shell.start(url=url, spider=spider) 
    File "/usr/lib/python2.7/dist-packages/scrapy/shell.py", line 45, in start 
self.fetch(url, spider) 
    File "/usr/lib/python2.7/dist-packages/scrapy/shell.py", line 90, in fetch 
reactor, self._schedule, request, spider) 
    File "/usr/lib/python2.7/dist-packages/twisted/internet/threads.py", line 122, in blockingCallFromThread 
result.raiseException() 
    File "<string>", line 2, in raiseException 
IOError: [Errno 2] No such file or directory: '/home/lotso/www.google.fr' 

正如你可以想象的➜ ~ pwd /home/lotso 如果我改變目錄它是一個ppends我在哪裏目錄 我試圖卸載python-scrapy與清除,然後通過點安裝它,我得到了同樣的問題

我現在虧了,我懷疑某個地方的環境變量,但沒有解決它自己...

+3

您未將完全限定的URL傳遞給您的腳本。 – duskwuff 2014-12-07 21:24:12

+0

omg ....我可以回我的問題嗎?謝謝你打開我的眼睛:) – euri10 2014-12-07 21:26:54

+0

在這裏得到了一個例子:'scrapy shell'http:// scrapy.org'' - > http://doc.scrapy.org/en/latest/topics/shell.html#example- shell-session – smarber 2014-12-07 21:27:14

回答

2

此方法scrapy 1.0.3和Debian 8.2

  1. 工作從此站點安裝依賴設置
    sudo apt-get install python-twisted python-libxml2 python- libxml2-dbg python-openssl python-simplejson
  2. 下載scrapy:http://scrapy.org/(例如:選擇壓縮包)
  3. 解壓並安裝
    tar zxf Scrapy-X.X.X.tar.gz; cd Scrapy-X.X.X; sudo python setup.py install
1

如何與Python 2.7 Debian的8(86)安裝Scrapy 1.3

重新啓動機器,從根目錄下運行(或使用sudo)。

apt-get update 
apt-get upgrade 
apt-get install virtualenv 

有關虛擬環境的基本信息:https://virtualenv.pypa.io/en/stable/userguide/

virtual ENV 
cd ENV 
source bin/activate 

虛擬ENV被激活,...(命令 「禁用」 簡單地將其停用)

apt-get install gcc 
apt-get install python-pip 
apt-get install cython 
apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev 
pip install pip --upgrade 
pip install scrapy 
pip install scrapy --upgrade 

這爲我工作,我將它應用於空安裝。

+0

在x64上測試Debian 8,Pyton 3.4 剛剛安裝了Scrapy 1.4.0 – Alioth 2017-05-23 18:46:41