2017-06-20 36 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