2016-10-18 3 views
0

私は、Windows 7システムにpython 2.7.12バージョンをインストールしました。 pywin32とVisual C++もインストールしました。 pip --versionコマンドを入力しても出力が生成されない場合、カーソルは次の行に移動して点滅します。新しいプロジェクトを開始する治療

しかし、私がコマンドpython -m pip --versionを使用すると、pipのバージョンが表示されます。また、scrapyをインストールするには、コマンドpython -m pip install scrapyを使用しなければなりませんでした。 Scrapyが正常にインストールされました。

私は正しく環境変数にパスを設定している - 私はscrapyに私の新しいプロジェクトを開始しなければならなかったとき

C:\Python27;C:\Python27\Scripts;私はコマンドscrapy startproject project_nameを使用しました。再度、カーソルは次の行に移動して点滅します。エラーメッセージも出力されません。

何度も試してみると、それぞれのファイルが入ったディレクトリにフォルダが作成されました。

コードを開発し、コマンドscrapy crawl nameでスパイダーを実行しようとしたときにも、同じ問題が発生しました - 応答なし。

もう一度同じ問題が発生したため、新しいプロジェクトを作成できません。

もし誰かが、エラーの考えられる理由とこれに対する解決策を提案してください。

私はコマンドpython -m scrapy <command> <arguments?を使用して、スクラップチュートリアルに従うと、 が処理されました。しかし、私はクロールコマンドを実行するまでそれは良かった。私はpython -m scrapy.cmdline shell 'http://quotes.toscrape.com/page/1/'コマンドを使用する場合には、エラーを示している

C:\Users\MinorMiracles\Desktop\tutorial>python -m scrapy.cmdline crawl quotes 
2016-10-19 10:26:15 [scrapy] INFO: Scrapy 1.2.0 started (bot: tutorial) 
2016-10-19 10:26:15 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'tu 
torial.spiders', 'SPIDER_MODULES': ['tutorial.spiders'], 'ROBOTSTXT_OBEY': True, 
'BOT_NAME': 'tutorial'} 
2016-10-19 10:26:16 [scrapy] INFO: Enabled extensions: 
['scrapy.extensions.logstats.LogStats', 
'scrapy.extensions.telnet.TelnetConsole', 
'scrapy.extensions.corestats.CoreStats'] 
2016-10-19 10:26:17 [scrapy] INFO: Enabled downloader middlewares: 
['scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware', 
'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware', 
'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware', 
'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware', 
'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware', 
'scrapy.downloadermiddlewares.retry.RetryMiddleware', 
'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware', 
'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware', 
'scrapy.downloadermiddlewares.redirect.RedirectMiddleware', 
'scrapy.downloadermiddlewares.cookies.CookiesMiddleware', 
'scrapy.downloadermiddlewares.chunked.ChunkedTransferMiddleware', 
'scrapy.downloadermiddlewares.stats.DownloaderStats'] 
2016-10-19 10:26:17 [scrapy] INFO: Enabled spider middlewares: 
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware', 
'scrapy.spidermiddlewares.offsite.OffsiteMiddleware', 
'scrapy.spidermiddlewares.referer.RefererMiddleware', 
'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware', 
'scrapy.spidermiddlewares.depth.DepthMiddleware'] 
2016-10-19 10:26:17 [scrapy] INFO: Enabled item pipelines: 
[] 
2016-10-19 10:26:17 [scrapy] INFO: Spider opened 
2016-10-19 10:26:17 [scrapy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 i 
tems (at 0 items/min) 
2016-10-19 10:26:17 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6023 
2016-10-19 10:26:18 [scrapy] DEBUG: Crawled (404) <GET http://quotes.toscrape.co 
m/robots.txt> (referer: None) 
2016-10-19 10:26:18 [scrapy] DEBUG: Crawled (200) <GET http://quotes.toscrape.co 
m/page/1/> (referer: None) 
2016-10-19 10:26:18 [quotes] DEBUG: Saved file quotes-1.html 
2016-10-19 10:26:18 [scrapy] DEBUG: Crawled (200) <GET http://quotes.toscrape.co 
m/page/2/> (referer: None) 
2016-10-19 10:26:19 [quotes] DEBUG: Saved file quotes-2.html 
2016-10-19 10:26:19 [scrapy] INFO: Closing spider (finished) 
2016-10-19 10:26:19 [scrapy] INFO: Dumping Scrapy stats: 
{'downloader/request_bytes': 675, 
'downloader/request_count': 3, 
'downloader/request_method_count/GET': 3, 
'downloader/response_bytes': 5974, 
'downloader/response_count': 3, 
'downloader/response_status_count/200': 2, 
'downloader/response_status_count/404': 1, 
'finish_reason': 'finished', 
'finish_time': datetime.datetime(2016, 10, 19, 4, 56, 19, 56000), 
'log_count/DEBUG': 6, 
'log_count/INFO': 7, 
'response_received_count': 3, 
'scheduler/dequeued': 2, 
'scheduler/dequeued/memory': 2, 
'scheduler/enqueued': 2, 
'scheduler/enqueued/memory': 2, 
'start_time': datetime.datetime(2016, 10, 19, 4, 56, 17, 649000)} 
2016-10-19 10:26:19 [scrapy] INFO: Spider closed (finished) 

C:\Users\MinorMiracles\Desktop\tutorial>python -m scrapy.cmdline shell 'http://q 
uotes.toscrape.com/page/1/' 
2016-10-19 11:11:40 [scrapy] INFO: Scrapy 1.2.0 started (bot: tutorial) 
2016-10-19 11:11:40 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'tu 
torial.spiders', 'ROBOTSTXT_OBEY': True, 'DUPEFILTER_CLASS': 'scrapy.dupefilters 
.BaseDupeFilter', 'SPIDER_MODULES': ['tutorial.spiders'], 'BOT_NAME': 'tutorial' 
, 'LOGSTATS_INTERVAL': 0} 
2016-10-19 11:11:40 [scrapy] INFO: Enabled extensions: 
['scrapy.extensions.telnet.TelnetConsole', 
'scrapy.extensions.corestats.CoreStats'] 
2016-10-19 11:11:40 [scrapy] INFO: Enabled downloader middlewares: 
['scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware', 
'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware', 
'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware', 
'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware', 
'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware', 
'scrapy.downloadermiddlewares.retry.RetryMiddleware', 
'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware', 
'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware', 
'scrapy.downloadermiddlewares.redirect.RedirectMiddleware', 
'scrapy.downloadermiddlewares.cookies.CookiesMiddleware', 
'scrapy.downloadermiddlewares.chunked.ChunkedTransferMiddleware', 
'scrapy.downloadermiddlewares.stats.DownloaderStats'] 
2016-10-19 11:11:40 [scrapy] INFO: Enabled spider middlewares: 
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware', 
'scrapy.spidermiddlewares.offsite.OffsiteMiddleware', 
'scrapy.spidermiddlewares.referer.RefererMiddleware', 
'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware', 
'scrapy.spidermiddlewares.depth.DepthMiddleware'] 
2016-10-19 11:11:40 [scrapy] INFO: Enabled item pipelines: 
[] 
2016-10-19 11:11:40 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6023 
2016-10-19 11:11:40 [scrapy] INFO: Spider opened 
2016-10-19 11:11:42 [scrapy] DEBUG: Retrying <GET http://'http:/robots.txt> (fai 
led 1 times): DNS lookup failed: address "'http:" not found: [Errno 11004] getad 
drinfo failed. 
2016-10-19 11:11:45 [scrapy] DEBUG: Retrying <GET http://'http:/robots.txt> (fai 
led 2 times): DNS lookup failed: address "'http:" not found: [Errno 11004] getad 
drinfo failed. 
2016-10-19 11:11:47 [scrapy] DEBUG: Gave up retrying <GET http://'http:/robots.t 
xt> (failed 3 times): DNS lookup failed: address "'http:" not found: [Errno 1100 
4] getaddrinfo failed. 
2016-10-19 11:11:47 [scrapy] ERROR: Error downloading <GET http://'http:/robots. 
txt>: DNS lookup failed: address "'http:" not found: [Errno 11004] getaddrinfo f 
ailed. 
DNSLookupError: DNS lookup failed: address "'http:" not found: [Errno 11004] get 
addrinfo failed. 
2016-10-19 11:11:49 [scrapy] DEBUG: Retrying <GET http://'http://quotes.toscrape 
.com/page/1/'> (failed 1 times): DNS lookup failed: address "'http:" not found: 
[Errno 11004] getaddrinfo failed. 
2016-10-19 11:11:51 [scrapy] DEBUG: Retrying <GET http://'http://quotes.toscrape 
.com/page/1/'> (failed 2 times): DNS lookup failed: address "'http:" not found: 
[Errno 11004] getaddrinfo failed. 
2016-10-19 11:11:54 [scrapy] DEBUG: Gave up retrying <GET http://'http://quotes. 
toscrape.com/page/1/'> (failed 3 times): DNS lookup failed: address "'http:" not 
found: [Errno 11004] getaddrinfo failed. 
Traceback (most recent call last): 
    File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main 
    "__main__", fname, loader, pkg_name) 
    File "C:\Python27\lib\runpy.py", line 72, in _run_code 
    exec code in run_globals 
    File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 161, in <module> 
    execute() 
    File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 142, in execute 
    _run_print_help(parser, _run_command, cmd, args, opts) 
    File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 88, in _run_print 
_help 
    func(*a, **kw) 
    File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 149, in _run_comm 
and 
    cmd.run(args, opts) 
    File "C:\Python27\lib\site-packages\scrapy\commands\shell.py", line 71, in run 

    shell.start(url=url) 
    File "C:\Python27\lib\site-packages\scrapy\shell.py", line 47, in start 
    self.fetch(url, spider) 
    File "C:\Python27\lib\site-packages\scrapy\shell.py", line 112, in fetch 
    reactor, self._schedule, request, spider) 
    File "C:\Python27\lib\site-packages\twisted\internet\threads.py", line 122, in 
blockingCallFromThread 
    result.raiseException() 
    File "<string>", line 2, in raiseException 
twisted.internet.error.DNSLookupError: DNS lookup failed: address "'http:" not f 
ound: [Errno 11004] getaddrinfo failed. 

誰もが

おかげで働いていた代替コマンドpython -m scrapy.cmdline <command> <arguments>(-vなどのpython -m scrapy.cmdlineバージョン)を使用して

+0

ここにコードを貼り付けると便利です。たとえば、あなたの 'scrapy.cfg'とあなたのスパイダーのコンテンツ。以前の質問のように間違ってクローラを実行しようとすることがあります。データがなければ、あなたを助けるのは難しいです。 – GHajba

+0

新しいプロジェクトコマンド自体が機能していません。私は自分の新しいフォルダを作成することができないし、私は自分のスパイダーをコードすることができます。どういうわけか私は以前の質問で私が問題に直面した昨日作成しました – clued

+0

'scrap version -v'と' scrap shell'は動作しますか?代わりに 'python -m scrapy.cmdline '(例えば 'python -m scrapy.cmdline version -v') –

答えて

0

間違っているものを私に伝えることができますPaul