目录
AttributeError: module ‘selenium.webdriver‘ has no attribute ‘PhantomJS‘
【常见模块错误】
【解决方案】
欢迎来到英杰社区
https://bbs.csdn.net/topics/617804998
欢迎来到我的主页,我是博主英杰,211科班出身,就职于医疗科技公司,热衷分享知识,武汉城市开发者社区主理人
擅长.net、C++、python开发, 如果遇到技术问题,即可私聊博主,博主一对一为您解答
修改代码、商务合作:
Yan--yingjie
Yan--yingjie
Yan--yingjie
如果出现模块错误

进入控制台输入:建议使用国内镜像源 pip install 模块名称 -i https://mirrors.aliyun.com/pypi/simple 我大致罗列了以下几种国内镜像源: 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple 阿里云 https://mirrors.aliyun.com/pypi/simple/ 豆瓣 https://pypi.douban.com/simple/ 百度云 https://mirror.baidu.com/pypi/simple/ 中科大 https://pypi.mirrors.ustc.edu.cn/simple/ 华为云 https://mirrors.huaweicloud.com/repository/pypi/simple/ 腾讯云 https://mirrors.cloud.tencent.com/pypi/simple/ 错误信息“AttributeError: module ‘selenium.webdriver ‘ has no attribute ‘PhantomJS‘”表明在使用Selenium库时,尝试访问不存在的属性或方法。具体来说,是因为Selenium已经不再支持PhantomJS驱动程序。
可以得出以下结论:
PhantomJS已被弃用:从Selenium 3.14版本开始,PhantomJS驱动程序被移除,并且不再维护。这意味着在新版本的Selenium中,无法直接使用PhantomJS来执行自动化任务。
解决方案:
实际操作步骤:
pip uninstall selenium pip install selenium==2.48.0 总结起来,由于PhantomJS已被弃用,建议用户切换到其他无头浏览器以确保自动化测试或数据抓取工作的顺利进行.