提示:selenim安装最好指定版本4.1.0和3.6.0所用的代码有出入,不兼容
1、问题描述:给树莓派正常安装 selenim时,出现如下问题:
2、尝试解决问题,但是没解决
3、终于解决了问题!!!
参考过:
https://blog.csdn.net/weixin_36302134/article/details/111969896
https://tech.iotcomeon.com/2018/06/tech/deploy/515/
**
一定要看下面
**
推荐换成 3.9.0
当我在使用3.6.0的时候发现,无头模式竟然没起作用,跟版本有关系!!!
导致我在给树莓派设置定时任务时候,总是执行不起来(原因:我猜测定时任务是在终端执行,要求无界面,否在不会执行,所以我卸载更新版本就好了)
pip3卸载python库指令
sudo pip3 uninstall selenium
安装指定3.9.0 python库指令
sudo pip3 install selenium==3.9.0
最好给文件加个权限x
sudo chmod +x mg.py
树莓派设置定时任务,重新加载任务
sudo nano /etc/crontab
sudo /etc/init.d/cron restart
树莓派之前执行python脚本(带selenium)时候,前面加了sudo,导致总出错,去掉sudo,反而好了
不要这样做:
sudo python mg.py
最好这样 ,权限不够加个x权限
python mg.py