ModuleNotFoundError:没有名为“certifi”的模块;
我已升级到 Selenium 4.1.3,但出现了问题。
C:\Users\me\Desktop\TA\TestPlan>python TestPlan_Something.py
Traceback (most recent call last):
File "TestPlan_Something.py", line 8, in <module>
from TestCases.Test import Test
File "C:\Users\me\Desktop\TA\TestPlan\TestCase\Test.py", line 56, in <module>
from Util.WebDriverEventListener import WebDriverEventListener as Listener
File "..\Util\WebDriverEventListener.py", line 30, in <module>
from selenium.webdriver.support.events import AbstractEventListener
File "C:\Users\me\Desktop\TA\Python\lib\selenium\webdriver\__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "C:\Users\me\Desktop\TA\Python\lib\selenium\webdriver\firefox\webdriver.py", line 27, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "C:\Users\me\Desktop\TA\Python\lib\selenium\webdriver\remote\webdriver.py", line 39, in <module>
from .remote_connection import RemoteConnection
File "C:\Users\me\Desktop\TA\Python\lib\selenium\webdriver\remote\remote_connection.py", line 26, in <module>
import certifi
ModuleNotFoundError: No module named 'certifi'
据我所知,certifi 安装在以下目录中:C:\Users\me\Desktop\TA\Python\Lib\site-packages\pip_vendor。
我不确定问题是什么。
I have upgraded to Selenium 4.1.3, and it's caused a problem.
C:\Users\me\Desktop\TA\TestPlan>python TestPlan_Something.py
Traceback (most recent call last):
File "TestPlan_Something.py", line 8, in <module>
from TestCases.Test import Test
File "C:\Users\me\Desktop\TA\TestPlan\TestCase\Test.py", line 56, in <module>
from Util.WebDriverEventListener import WebDriverEventListener as Listener
File "..\Util\WebDriverEventListener.py", line 30, in <module>
from selenium.webdriver.support.events import AbstractEventListener
File "C:\Users\me\Desktop\TA\Python\lib\selenium\webdriver\__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "C:\Users\me\Desktop\TA\Python\lib\selenium\webdriver\firefox\webdriver.py", line 27, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "C:\Users\me\Desktop\TA\Python\lib\selenium\webdriver\remote\webdriver.py", line 39, in <module>
from .remote_connection import RemoteConnection
File "C:\Users\me\Desktop\TA\Python\lib\selenium\webdriver\remote\remote_connection.py", line 26, in <module>
import certifi
ModuleNotFoundError: No module named 'certifi'
As far as I can tell certifi is installed in the following directory: C:\Users\me\Desktop\TA\Python\Lib\site-packages\pip_vendor.
I'm not sure what the problem is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:
在文件 remote_connection.py 中,我将
sys.path.append()
替换为sys.path.insert(0, path)
并传入文件路径字符串“...\Python\Lib\site_packages\pip\_vendor”作为路径。Solution:
In the file remote_connection.py I replaced
sys.path.append()
withsys.path.insert(0, path)
and passed in the filepath string "...\Python\Lib\site_packages\pip\_vendor" as path.