[Python] How do I install Geckodriver?

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am attempting to work with Selenium in Python. However, I do not know what to do given the below from selenium (PyPI).


    Selenium requires a driver to interface with the chosen browser. Firefox, for example, requires geckodriver, which needs to be installed before the below examples can be run. Make sure it’s in your PATH, e.g., place it in /usr/bin or /usr/local/bin.
    ​

    I am running Windows 7 32 bit. I found geckodriver here.

    I have mostly used the Anaconda distribution of Python to work with Excel, so I do not know what a "PATH" is.

    I updated the PATH as shown in the comments. Here is the full error traceback:

    cd C:\Users\user1
    python


    Output:

    Python 3.5.2 |Anaconda 4.2.0 (32-bit)| (default, Jul 5 2016, 11:45:57) [MSC v.1
    900 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.


    And

    from selenium import webdriver
    driver = webdriver.Firefox()


    Output:

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Users\user1\AppData\Local\Continuum\Anaconda3\lib\site
    -packages\selenium-2.53.6-py3.5.egg\selenium\webdriver\firefox\webdriver.py", li
    ne 80, in __init__
    self.binary, timeout)
    File "C:\Users\user1\AppData\Local\Continuum\Anaconda3\lib\site
    -packages\selenium-2.53.6-py3.5.egg\selenium\webdriver\firefox\extension_connect
    ion.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
    File "C:\Users\user1\AppData\Local\Continuum\Anaconda3\lib\site
    -packages\selenium-2.53.6-py3.5.egg\selenium\webdriver\firefox\firefox_binary.py
    ", line 67, in launch_browser
    self._start_from_profile_path(self.profile.path)
    File "C:\Users\user1\AppData\Local\Continuum\Anaconda3\lib\site
    -packages\selenium-2.53.6-py3.5.egg\selenium\webdriver\firefox\firefox_binary.py
    ", line 90, in _start_from_profile_path
    env=self._firefox_env)
    File "C:\Users\user1\AppData\Local\Continuum\Anaconda3\lib\subp
    rocess.py", line 947, in __init__
    restore_signals, start_new_session)
    File "C:\Users\user1\AppData\Local\Continuum\Anaconda3\lib\subp
    rocess.py", line 1224, in _execute_child
    startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    Continue reading...

Compartilhe esta Página