安裝selenium,驅動geckodriver,及出現的問題


 

cmd輸入安裝selenium指令:

pip install selenium

 

1.報錯 Could not find a version that satisfies the requirement selenium (from versions: )
No matching distribution found for selenium

說找不到合適的版本

 

解決:找了很多資料,其中有個說切換網絡的,我試了一下,果然有用。我連接的移動校園網,后來用手機開了4G熱點,連接后再下載,就沒有這個報錯了。

但是:出現了新的錯誤:

 

2.報錯:Could not install packages due to an EnvironmentError: [WinError 5] 拒絕訪問。: 'C:\\Program Files\\Python37\\Lib\\site-packages\\selenium'
Consider using the `--user` option or check the permissions.

解決:權限問題,把安裝指令改為:

pip install --user selenium

 

成功安裝,警告被我忽略了。

 

安裝驅動geckodriver(驅動用於打開瀏覽器)

下載地址:https://github.com/mozilla/geckodriver/releases

解壓到python文件根目錄。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM