AlexTan-b-z / ZhihuSpider

知乎分布式爬虫(Scrapy、Redis)
MIT License
164 stars 59 forks source link

selenium.common.exceptions.WebDriverException: Message: Service phantomjs unexpectedly exited #7

Closed Paw2Pom closed 6 years ago

Paw2Pom commented 6 years ago

我用"npm install phantomjs-prebuilt"來裝phantomjs, 但一只出現這個error:

====

$ scrapy list /usr/local/lib/python2.7/dist-packages/selenium/webdriver/phantomjs/webdriver.py:49: UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless ' Traceback (most recent call last): File "/usr/local/bin/scrapy", line 11, in sys.exit(execute()) File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 149, in execute cmd.crawler_process = CrawlerProcess(settings) File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 249, in init super(CrawlerProcess, self).init(settings) File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 137, in init self.spider_loader = _get_spider_loader(settings) File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 336, in _get_spider_loader return loader_cls.from_settings(settings.frozencopy()) File "/usr/local/lib/python2.7/dist-packages/scrapy/spiderloader.py", line 61, in from_settings return cls(settings) File "/usr/local/lib/python2.7/dist-packages/scrapy/spiderloader.py", line 25, in init self._load_all_spiders() File "/usr/local/lib/python2.7/dist-packages/scrapy/spiderloader.py", line 47, in _load_all_spiders for module in walk_modules(name): File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/misc.py", line 71, in walk_modules submod = import_module(fullpath) File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) File "/apps/AlexTan-b-z_ZhihuSpider/zhihu/zhihu/spiders/zhihuspider.py", line 22, in class ZhihuspiderSpider(RedisSpider): File "/apps/AlexTan-b-z_ZhihuSpider/zhihu/zhihu/spiders/zhihuspider.py", line 34, in ZhihuspiderSpider obj = webdriver.PhantomJS(desired_capabilities=dcap) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/phantomjs/webdriver.py", line 56, in init self.service.start() File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 98, in start self.assert_process_still_running() File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running % (self.path, return_code) selenium.common.exceptions.WebDriverException: Message: Service phantomjs unexpectedly exited. Status code was: -6

AlexTan-b-z commented 6 years ago

V-docker版本: https://github.com/AlexTan-b-z/ZhihuSpider/tree/V-docker 里面有phantomjs的安装包哦,你直接clone下来,运行命令:

  1. COPY ./phantomjs-2.1.1-linux-x86_64 /usr/local/src/phantomjs
  2. ln -sf /usr/local/src/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
Paw2Pom commented 6 years ago

可以執行了!!! 感謝 !!

AlexTan-b-z commented 6 years ago

不客气