python报错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python报错相关的知识,希望对你有一定的参考价值。
"C:\Python 3.5\python.exe" C:/Users/Administrator/.PyCharmCE2017.1/config/scratches/scratch.py
Traceback (most recent call last):
File "C:/Users/Administrator/.PyCharmCE2017.1/config/scratches/scratch.py", line 4, in <module>
driver=webdriver.Firefox()
File "C:\Python 3.5\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 70, in __init__
self.binary = FirefoxBinary()
File "C:\Python 3.5\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 50, in __init__
"binary = FirefoxBinary('/path/to/binary')\ndriver = webdriver.Firefox(firefox_binary=binary)")
Exception: Failed to find firefox binary. You can set it by specifying the path to 'firefox_binary':
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('/path/to/binary')
driver = webdriver.Firefox(firefox_binary=binary)
Process finished with exit code 1
运行程序时报这样的问题,是为什么?我就写了
from selenium import webdriver
from time import sleep
driver=webdriver.Firefox()
是我的火狐浏览器的问题吗?还是那些配置没配置好?
从信息中可看出,Selenium 无法启动 Friefox 浏览器而导致程序报错信息。解决步骤:
初始以为是因为 WebDriver 驱动的问题,更换后发现问题依然存在
查看其 Firefox 的版本为 35,觉得问题出在了 Firefox 版本与 selenium-server-standalone 版本不对应导致的,于是将 Firefox 版本降至 31,脚本运行通过;
将 Firefox 版本升级为 35,下载最新的 selenium-server-standalone-2.44.0.jar
python pip install mysql-python报错
报错:
下载地址:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
以上是关于python报错的主要内容,如果未能解决你的问题,请参考以下文章
我写了一个python程序,报错NameError: name XX is not defined 求解