【问题标题】:I can't open selenium in vscode我无法在 vscode 中打开 selenium
【发布时间】:2021-09-18 08:56:07
【问题描述】:

这是我的代码:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get("http://www.python.org")

我只是尝试测试,但打印的内容相同。

Traceback (most recent call last):
  File "C:\python\selenium\google.py", line 1, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
PS C:\python\selenium> 

我安装了 selenium,但它没有运行。 我该怎么办?

【问题讨论】:

    标签: python selenium selenium-webdriver visual-studio-code


    【解决方案1】:

    没有名为“selenium”的模块意味着您尚未安装 selenium。所以首先运行pip install selenium

    【讨论】:

      【解决方案2】:

      ModuleNotFoundError: 没有名为“selenium”的模块

      这个错误意味着没有Selenium安装

      请参阅here 了解如何安装 Selenium。

      Python

      可以使用 pip 为 Python 安装 Selenium 库:

      pip install selenium
      

      或者,您可以下载 PyPI 源存档 (selenium-x.x.x.tar.gz) 并使用 setup.py 进行安装:

      python setup.py install
      

      【讨论】:

        猜你喜欢
        • 2020-07-13
        • 1970-01-01
        • 2020-07-20
        • 2020-08-18
        • 1970-01-01
        • 1970-01-01
        • 2020-11-25
        • 2022-01-27
        • 1970-01-01
        相关资源
        最近更新 更多