代码运行 MAC 没问题, 去跑 ubuntu 报错了,找不到办法(爬虫问题,selenuim 调用)

2016-08-02 12:43:14 +08:00
 redhatping

   driver = webdriver.Firefox(firefox_profile=ffprofile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 65, in __init__
    self.service.start()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 71, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x3359310>> ignored

报错信息如上..

环境: Ubuntu sever

Selenium : 3.0 ( pip install -U selenium)

Firefox ( usr/bin , sudo apt-get update )

报错原因; MAC OS 执行没有问题, 换了环境去了 Ubuntu 出错了. 努力 GOOGLE 没找到办法, 谢谢大家了.

6409 次点击
所在节点    Python
29 条回复
Garantion
2016-08-02 17:50:58 +08:00
@redhatping 我之前也是在 MAC 下开发的,不过移动到的就是普通的 ubuntu 14.04 LTS , server 装了界面这个就不清楚了。
sodatea
2016-08-02 17:56:41 +08:00
geckodriver 跟 firefox 又不是一回事……
redhatping
2016-08-02 18:02:26 +08:00
@IMRES 没这个东西 whick 是空的
redhatping
2016-08-02 18:02:51 +08:00
@eclipselu 没看懂怎么安装 geckodriver
redhatping
2016-08-02 18:03:14 +08:00
@sodatea 对啊, 似乎是两个东西 请问怎么办呢
eclipselu
2016-08-02 18:24:30 +08:00
@redhatping https://github.com/mozilla/geckodriver/releases 这里下载一个 linux64 下的放到 PATH 下的随便一个目录试试看?
eclipselu
2016-08-02 18:24:55 +08:00
@redhatping 或者自己编译一个
redhatping
2016-08-02 18:36:33 +08:00
@eclipselu 好好 试试
redhatping
2016-08-03 05:34:34 +08:00
@eclipselu 解决了 就是这个问题

mark:

answer: download geckodriver to /usr/bin .
the urllink of geckodriver is github.com/mozilla/geckodriver releases.

ubuntu server .

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://tanronggui.xyz/t/296540

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX