Python Jupyter笔记本电脑selenium webdriver webdriver不';t工作/打开

Python Jupyter笔记本电脑selenium webdriver webdriver不';t工作/打开,python,Python,我安装了te selenium模块并输入了coe以打开webbrowser,但出现错误,webbrowser无法打开。实际上,访问我的浏览器不起作用。我是Python新手,正在学习一门在线课程。前两行是我的条目,下面是错误。能找个人帮忙吗 from selenium import webdriver browser=webdriver.Firefox() ----------------------------------------------------------------------

我安装了te selenium模块并输入了coe以打开webbrowser,但出现错误,webbrowser无法打开。实际上,访问我的浏览器不起作用。我是Python新手,正在学习一门在线课程。前两行是我的条目,下面是错误。能找个人帮忙吗

from selenium import webdriver
browser=webdriver.Firefox()

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
C:\Users\Public\Anaconda\lib\site-packages\selenium\webdriver\common\service.py in start(self)
     75                                             stderr=self.log_file,
---> 76                                             stdin=PIPE)
     77         except TypeError:

C:\Users\Public\Anaconda\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
    776         except:

C:\Users\Public\Anaconda\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
   1179             finally:

FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

WebDriverException                        Traceback (most recent call last)
<ipython-input-91-0532aeb968a6> in <module>
----> 1 browser=webdriver.Firefox()

C:\Users\Public\Anaconda\lib\site-packages\selenium\webdriver\firefox\webdriver.py in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy, executable_path, options, service_log_path, firefox_options, service_args, desired_capabilities, log_path, keep_alive)
    162                 service_args=service_args,
    163                 log_path=service_log_path)
--> 164             self.service.start()
    165 
    166             capabilities.update(options.to_capabilities())

C:\Users\Public\Anaconda\lib\site-packages\selenium\webdriver\common\service.py in start(self)
     81                 raise WebDriverException(
     82                     "'%s' executable needs to be in PATH. %s" % (
---> 83                         os.path.basename(self.path), self.start_error_message)
     84                 )
     85             elif err.errno == errno.EACCES:

WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
从selenium导入webdriver
browser=webdriver.Firefox()
---------------------------------------------------------------------------
FileNotFoundError回溯(最近一次调用上次)
C:\Users\Public\Anaconda\lib\site packages\selenium\webdriver\common\service.py在start(self)中
75 stderr=self.log_文件,
--->76标准偏差=管道)
77除类型错误外:
C:\Users\Public\Anaconda\lib\subprocess.py in_uuuuuinit_uuuuuu(self、args、bufsize、executable、stdin、stdout、stderr、preexec_fn、close_fds、shell、cwd、env、universal_新行、startupinfo、creationflags、restore_信号、start_new_会话、pass_fds、编码、错误、文本)
774错误读取,错误写入,
-->775恢复信号,启动新会话)
776除:
C:\Users\Public\Anaconda\lib\subprocess.py in_execute_child(self、args、execute、preexec_fn、close_fds、pass_fds、cwd、env、startupinfo、creationflags、shell、p2cread、p2cwrite、c2pwrite、errread、errwrite、未使用的恢复信号、未使用的启动新会话)
1177 os.fspath(cwd)如果cwd不是None-else-None,
->1178(创业信息)
1179最后:
FileNotFoundError:[WinError 2]系统找不到指定的文件
在处理上述异常期间,发生了另一个异常:
WebDriverException回溯(最近一次调用上次)
在里面
---->1 browser=webdriver.Firefox()
C:\Users\Public\Anaconda\lib\site packages\selenium\webdriver\firefox\webdriver.py in\uuuuu init\uuuuuuuuuu(self、firefox\u配置文件、firefox\u二进制文件、超时、功能、代理、可执行路径、选项、服务日志路径、firefox\u选项、服务参数、所需的\u功能、日志路径、保持\u活动)
162服务参数=服务参数,
163日志路径=服务日志路径)
-->164自助服务启动()
165
166能力。更新(选项。到_能力()
C:\Users\Public\Anaconda\lib\site packages\selenium\webdriver\common\service.py在start(self)中
81提出WebDriverException(
82“'%s'可执行文件需要位于路径中。%s”%(
--->83 os.path.basename(self.path)、self.start\u错误消息)
84                 )
85 elif err.errno==errno.EACCES:
WebDriverException:消息:“geckodriver”可执行文件需要位于路径中。

将可执行文件路径设置为
geckodriver.exe

比如说,

from selenium import webdriver
driver = webdriver.Firefox(executable_path=r'your\path\geckodriver.exe')


如果您获得了错误的权限,请尝试从路径中删除[r'],只需“excecutable\u path='path\to\your'diretory'”将您的可执行路径设置为
geckodriver.exe

比如说,

from selenium import webdriver
driver = webdriver.Firefox(executable_path=r'your\path\geckodriver.exe')


如果您获得了错误的权限,请尝试从路径中删除[r'],只需“excecutable\u path='path\to\your'diretory'”

如果它不在路径中,您可以指定包所在的路由。问题解决了吗?如果它不在路径中,您可以指定包所在的路由。问题解决了吗?