synbe / issue

0 stars 0 forks source link

Python #14

Open synbe opened 5 years ago

synbe commented 5 years ago

Python

synbe commented 5 years ago

selenium + PhantomJS使用时 PhantomJS报错解决

在做动态网页爬虫时用到了selenium + PhantomJS,安装好之后运行时报错:
UserWarning: Selenium support for PhantomJS has been deprecated, 
please use headless versions of Chrome or Firefox instead 
warnings.warn('Selenium support for PhantomJS has been deprecated, 
please use headless '

说是 Selenium 已经弃用 PhantomJS ,请使用火狐或者谷歌无界面浏览器。查找之后得到答案时selenium的版本问题,使用pip show selenium显示默认安装的是3.8.1版本

卸载之后重新pip install selenium==2.48.0安装成功

专门写出来这个版本号是因为我使用2.0.0安装报错

 error: package directory 'build\src\py\test' does not exist
 ----------------------------------------
 Command "python setup.py egg_info" failed with error code 1 in           
 C:\Users\OLD_DR~1\AppData\Local\Temp\pip-build-vqjzohmy\selenium\

之后运行爬虫没有报错,搞定!!!

synbe commented 2 years ago

7dd98d1001e939017599e161095a09ee37d19611