說明:
正常情況下在pyCharm設置中使用pip安裝selenium時安裝不會出現問題,由於默認外網網址連接不太穩定,網速很慢,所以需要在中修改為https://pypi.doubanio.com/simple/和http://mirrors.aliyun.com/pypi/simple/
如果上述方法仍無法解決安裝selenium時提示報錯的問題:ModuleNotFoundError: No module named 'selenium'
操作:
1.下載當前最新的selenium-3.141.0.tar.gz
https://pypi.org/project/selenium/#files
2.解壓壓縮包,然后在解壓路徑下執行python setup.py install
安裝完成后進行驗證:
from selenium import webdriver driver = webdriver.Chrome() driver.get('http://www.baidu.com') driver.find_element_by_id('kw').send_keys('新冠肺炎疫情播報\n')
編輯好代碼后點擊運行: