即使我导入了硒,硒也不起作用

时间:2019-01-24 06:00:23

标签: python selenium python-idle

我第一次尝试使用硒。 首先,我用代码"pip install selenium."安装了Selenium,然后检查了"C:\Users\tstak\Anaconda3\Lib\site-packages."文件夹中的“ selenium”文件夹 但是,硒在IDLE(Python 3.7)中不起作用,其代码为“从硒导入webdriver。”

我下载了硒,然后检查硒在哪里。

 from selenium import webdriver
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
>>> from selenium important webdriver
SyntaxError: invalid syntax
>>> from selenium import webdriver
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
>>> from selenium import webdriver
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
>>> from selenium import webdriver
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
>>> from selenium import webdriver
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
>>> from selenium import webdriver
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
>>> 

1 个答案:

答案 0 :(得分:1)

我相信Anaconda3和Python默认IDLE会从不同目录提取已安装的软件包。

还要确保您还安装了最新版本的geckodriver,否则它可能仍然无法正常工作。我是python新手,也有这个问题,但是这里有一个问题对我帮助了geckodriver。

How to use the gecko executable with Selenium