从selenium导入webdriver的模块找不到错误:没有名为'selenium'的模块(PyCharm)

2024-04-28 23:11:12 发布

您现在位置:Python中文网/ 问答频道 /正文

在使用Selenium WebDriver运行脚本时,我在PyCharm中遇到问题:

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/ratmir/PycharmProjects/TestAutomationGF/Test/firsttest.py
Traceback (most recent call last):
  File "/Users/ratmir/PycharmProjects/TestAutomationGF/Test/firsttest.py", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'

我已检查是否安装了selenium:

python -m pip install -U selenium
Requirement already up-to-date: selenium in /Library/Python/2.7/site-packages

我看到在PyCharm中我有另一个版本的Python。。。你能帮我解决这个问题吗?谢谢。


Tags: inpytest脚本usrseleniumuserspycharm
1条回答
网友
1楼 · 发布于 2024-04-28 23:11:12

在Python27文件夹或Python34文件夹中使用python -m pip install selenium,无论您使用哪个文件夹(最好是3.4),然后在设置中选择相应的解释器,尝试使用PyCharm,或者使用PyCharm进行安装。

相关问题 更多 >