How do I retrieve the version of Selenium currently installed, from Python?
Asked Answered
B

6

30

How can I programmatically get the version of Selenium I have installed in my Python environment?

Butterfingers answered 6/12, 2013 at 16:22 Comment(0)
E
59

As simply as

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

or for command line:

$ python -c "import selenium; print(selenium.__version__)"
2.37.2
Ezana answered 6/12, 2013 at 16:28 Comment(2)
Thanks! For some reason I couldn't craft a Google query that would unearth the answer.Butterfingers
@nemesys That was an easy too, google.com/search?q=python+module+version :)Ezana
F
19

Try using pip show selenium. That worked for me.

Fathead answered 19/2, 2021 at 20:21 Comment(1)
Honestly, this is simpler than the accepted solution. Cheers!Malmo
M
7

You can try:

  1. pip list

  2. conda list

Or for example on Mac:

  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 myenv, where myenv is the name of your second or more test environments.

Muscovado answered 30/12, 2019 at 10:4 Comment(0)
D
4

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

pip freeze

It will list all the used libraries with their versions.

Deputize answered 30/12, 2019 at 9:34 Comment(1)
What pip freeze is and where for used is explained here at another SO question.Muscovado
S
1

There are 2 methods to retrieve it

  1. Using the command line in command prompt
pip show selenium
  1. Run a python file
import selenium

print("Selenium version:", selenium.__version__)
Spinode answered 12/7, 2024 at 1:48 Comment(0)
A
-1

Download pip to Anaconda and then pip install selenium through the Anaconda prompt.

Alumna answered 8/3, 2023 at 13:31 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Hushhush
Is some of this a (literal) command line?Inertia

© 2022 - 2025 — McMap. All rights reserved.