首页 > 编程语言 >playwright python环境运行报错 ImportError: DLL load failed

playwright python环境运行报错 ImportError: DLL load failed

时间:2023-09-27 10:39:06浏览次数:52  
标签:load playwright py sync 报错 ._ import line




playwright python环境运行报错 ImportError: DLL load failed_Powered by 金山文档


网上建议

网上好多文章介绍playwright的环境搭建,用以下两条语句即可完成

pip install playwright

playwright install

安装完毕后,尝试执行一段经典的python demo

from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("http://www.baidu.com")
print(page.title())
browser.close()

很不幸,相信绝大多数同学会遇到下面的报错

Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/playwright/demo1.py", line 1, in <module>
from playwright.sync_api import sync_playwright
File "C:\Python37\lib\site-packages\playwright\sync_api\__init__.py", line 25, in <module>
import playwright.sync_api._generated
File "C:\Python37\lib\site-packages\playwright\sync_api\_generated.py", line 25, in <module>
from playwright._impl._accessibility import Accessibility as AccessibilityImpl
File "C:\Python37\lib\site-packages\playwright\_impl\_accessibility.py", line 17, in <module>
from playwright._impl._connection import Channel
File "C:\Python37\lib\site-packages\playwright\_impl\_connection.py", line 23, in <module>
from greenlet import greenlet
File "C:\Python37\lib\site-packages\greenlet\__init__.py", line 29, in <module>
from ._greenlet import _C_API # pylint:disable=no-name-in-module
ImportError: DLL load failed: 找不到指定的模块。

这个问题该如何解决呢?还需要安装模块msvc-runtime

pip install msvc-runtime

然后再次运行脚本,可以正常运行!

最靠谱的做法

执行三条语句

pip install playwright

playwright install

pip install msvc-runtime

标签:load,playwright,py,sync,报错,._,import,line
From: https://blog.51cto.com/liwen629/7621137

相关文章

  • 干货!Playwright架构与Selenium 架构对比
    在Web测试自动化方面,Selenium多年来一直是行业的主导工具。但是,市场上还有许多其他自动化测试工具。Playwright是一种较新的工具,已经越来越受欢迎。网上有很多文章对二者进行对比,今天我从二者的架构角度进行一下对比分析!关于二者在其他方面的区别,我会在后面的文章中持续更新,......
  • 视频融合平台EasyCVR接入华为ivs3800平台提示400报错的原因及解决方法
    青犀视频平台的开源EasyDarwin视频监控解决方案EasyCVR在复杂网络环境中表现出色。它能够将分散的各类视频资源集中管理,实现统一汇聚和整合。EasyCVR支持多种画面窗口播放模式,包括1、4、9、16个画面窗口,同时可以播放多路视频流,并且支持视频定时轮播功能。此外,EasyCVR还兼容多种播......
  • VUE 3.0使用Tinymce编辑器JS报错解决
    接上篇文章写到的Tinymce编辑器,突然发现了,多点击几次编辑弹框内容就会变空白,而且JS报错了。如下图: 点开这个js就能发现错误的地方了改这两个文件就可以了,代码如下:if(typeofe.content!=='string'){e.content=e.content.innerHTML;}    这样......
  • Qt报错: variable has incomplete typte ‘QJsonObject’
    Qt常见运行失败的记录1.变量声明未实例化变量在头文件声明了,没new出来直接使用,导致程序运行崩溃2.定义变量时候下面出行红线,出现variblehasincompletetype‘QTextStream’variblehasincompletetype'QTextStream未添加QTextStream头文件3.Qt信号与槽连接失败的几......
  • odoo xml文件中&出现报错问题:Unescaped & or nonterminated character/entity referen
    解决方式1:将“&”改写为“&amp;” 解决方案2:使用CDATA区:当大量的转义字符出现在xml文档中时,会使xml文档的可读性大幅度降低,这时应该使用CDATA段。在CDATA段中出现的“ < ”、“ > ”、“ " ”、“ ’ ”、“&”都无需使用转义字符,但CDATA段中不能包含“]]>”,......
  • 转!!java ssh远程服务器报错 解决方法 Key exchange was not finished, connection is c
    转自:https://blog.csdn.net/weixin_45266856/article/details/129754122是ssh中的key交换算法不兼容导致 ssh报错解决:vi/etc/ssh/sshd_configKexAlgorithmsdiffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-gro......
  • Error: Could not find or load main class org.apache.zookeeper.server.quorum.Quor
    下载mavenapache-maven-3.9.4-bin.tar.gz解压tar-zxvfapache-maven-3.9.4-bin.tar.gz添加环境变量vim/etc/profileexportMAVEN_HOME=/usr/local/maven-3.9.4exportPATH=${PATH}......
  • ls报错修改环境变量
    问题:系统找不到环境变量在终端输入:ls后显示:root@wei:/etc#lsCommand'ls'isavailablein'/bin/ls'Thecommandcouldnotbelocatedbecause'/bin'isnotincludedinthePATHenvironmentvariable.ls:commandnotfound解决办法:直接在终端输入:expor......
  • 根据类名查找元素时 因为类名包含空格导致报错
    #导包importtimefromseleniumimportwebdriverfromselenium.webdriver.common.byimportByfromtimeimportsleep#引用谷歌驱动driver=webdriver.Chrome()driver.get(r"D:\python-pro\baseapitest\xpath\html.html")#输入密码driver.find_element(By.CLA......
  • Mac故障排查系列:redis删除key报错MISCONF Redis is configured to save RDB snapshots
    背景:Mac下使用AnotherRedisDesktopManager客户端,删除key,遇到报错:MISCONFRedisisconfiguredtosaveRDBsnapshots,butit'scurrentlyunabletopersisttodisk.Commandsthatmaymodifythedatasetaredisabled,becausethisinstanceisconfiguredtoreporte......