在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/Python  Linux  網(wǎng)絡(luò)安全/ apache+mod_wsgi+flask導(dǎo)入selenium.webdrive

apache+mod_wsgi+flask導(dǎo)入selenium.webdriver報(bào)錯(cuò)

問(wèn)題是這樣的:
我在flask導(dǎo)入selenium.webdriver的時(shí)候,訪問(wèn)不了,報(bào)錯(cuò):
from .firefox.webdriver import WebDriver as Firefox # noqa
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 35, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 994
return {k: size[k] for k in ('width', 'height')}
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 991
return {k: size[k] for k in ('width', 'height')}

但是我直接打開python命令行,導(dǎo)入selenium.driver并沒有報(bào)錯(cuò)
不用服務(wù)器啟動(dòng),直接運(yùn)行那個(gè)flask和有導(dǎo)入selenium的py文件,也沒有報(bào)錯(cuò)啊

為什么會(huì)報(bào)SyntaxError: invalid syntax呢?

然后我把報(bào)錯(cuò)的那行注釋掉,還是會(huì)在其他行報(bào)SyntaxError: invalid syntax錯(cuò)誤,這是為什么啊?
我把selenium包重新安裝了,錯(cuò)誤還是一樣。
應(yīng)該不是selenium庫(kù)的錯(cuò)誤吧?
要如何解決這個(gè)問(wèn)題呢?謝謝各位了

回答
編輯回答
喵小咪

找到答案了,是由于linux自帶的是python2.6,它不允許 {k: size[k] for k in ('width', 'height')}這樣的寫法。安裝python3就可以了

2017年4月1日 01:22