2017-06-20 98 views
3

我已将selenium下载到我的Mac。我试图用硒运行在python脚本,但我得到的错误:使用python与家庭安装硒安装硒

Traceback (most recent call last): 
File "selenium.py", line 3, in <module> 
    from selenium import webdrive 
File "/Users/shynds23/python/selenium.py", line 3, in <module> 
    from selenium import webdriver 
ImportError: cannot import name webdriver 

我的脚本有这些标题:

from selenium import webdriver 
from selenium.webdriver.common.keys import Keys 
from selenium.common.exceptions import NoSuchElementException 
import time 

关于如何解决它的任何想法?

回答

1

尝试下载硒使用PIP代替:

pip install selenium 

如果PIP没有安装你的机器上,运行:

python get-pip.py 

这里是链接得到点子:

https://bootstrap.pypa.io/get-pip.py

+0

我跑了第一个,没有点,所以我跑了第二个,它给了这个错误:pyth on:无法打开文件'get-pip.py':[Errno 2]没有这样的文件或目录 –

+0

转到此链接:https://stackoverflow.com/questions/30146222/how-to-install-pip-上蟒蛇错误,没有这样的文件,或目录。向下滚动至唯一答案,然后点击“此处”提供的链接。它会下载get-pip.py。确保将其移动到您安装了python的目录中。然后,运行python get-pip.py – Ajax1234

+0

让我知道这是否适合你。 – Ajax1234