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

如果发现文章中有错误的地方,欢迎大家指正,谢谢!

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