How can I programmatically get the version of Selenium I have installed in my Python environment?
How do I retrieve the version of Selenium currently installed, from Python?
Asked Answered
As simply as
>>> import selenium
>>> selenium.__version__
'2.37.2'
or for command line:
$ python -c "import selenium; print(selenium.__version__)"
2.37.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
Try using pip show selenium
. That worked for me.
Honestly, this is simpler than the accepted solution. Cheers! –
Malmo
You can try:
pip list
conda list
Or for example on Mac:
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.
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.
What
pip freeze
is and where for used is explained here at another SO question. –
Muscovado There are 2 methods to retrieve it
- Using the command line in command prompt
pip show selenium
- Run a python file
import selenium
print("Selenium version:", selenium.__version__)
Download pip to Anaconda and then pip install selenium through the Anaconda prompt.
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.