如何从 Python 中检索当前安装的 Selenium 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20428732/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 20:24:53  来源:igfitidea点击:

How do I retrieve the version of Selenium currently installed, from Python

pythonselenium

提问by A.R.

The title says it all, I want to programmatically get the version of Selenium I have installed on my Python environment.

标题说明了一切,我想以编程方式获取我在 Python 环境中安装的 Selenium 版本。

采纳答案by alko

As simply as

就像

>>> import selenium
>>> selenium.__version__
'2.37.2'

or for command line:

或命令行:

$ python -c "import selenium; print(selenium.__version__)"
2.37.2

回答by Abhishek

Please Use below command to see the version of the libraries that would have been installed using pip

请使用以下命令查看使用 pip 安装的库的版本

pip freeze

It will list all the used libraries with their versions.

它将列出所有使用的库及其版本。

回答by ZF007

You can try:

你可以试试:

  1. pip list

  2. conda list

  1. pip list

  2. conda list

or for example on MAC:

或者例如在 MAC 上:

  1. brew list
  1. brew list

And then check if and what version is in your installed package list.

然后检查您安装的软件包列表中是否存在以及什么版本。

For conda you might have different environments. Change it by conda activate myenvwhere myenvis the name of your second or more test environments.

对于 conda,您可能有不同的环境。更改它,conda activate myenv其中myenv是您的第二个或多个测试环境的名称。