python問題彙總

操作系統:Ubuntu14.04

**

python開發過程中遇到的問題記錄一下方便查找(持續更新):

**
1.Cannot uninstall ‘urllib3’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
問題解析:舊版本依賴多,不能清晰的刪除,此時應該忽略舊版本升級,即如下
解決辦法:sudo pip install urllib3 --ignore-installed urllib3

2.FileNotFoundError: [Errno 2] No such file or directory: ‘geckodriver’
問題解析:缺少火狐瀏覽器驅動文件geckodriver
解決辦法: 在如下網址找對應自己系統的驅動:https://github.com/mozilla/geckodriver/releases/
3.selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
問題解析:瀏覽器版本和驅動不對應
解決辦法: 尋找瀏覽器版本匹配的驅動文件,或者更新瀏覽器

4.TypeError: urlopen() got multiple values for keyword argument ‘body’
問題解析:urllib3版本太低
解決辦法: sudo pip install urllib3或sudo pip3 install urllib3

5.See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnin
解決辦法:
import urllib3
urllib3.disable_warnings()

6.pip安裝到python2路徑下(python2和python3共存,默認python3)
解決方法:python2 -m pip install xxx

如果發現文章中有錯誤的地方,歡迎大家指正,謝謝!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章