what is the difference between "python -v" and "python -V" when run in ubuntu/trusty64?

I am trying to determine the python version but when I run the command python -V with a lower case "v" I see I was moved to the python prompt rather than just returning the python version with me. I tried finding the difference between the 2 but couldn't find anything helpful. Please advice as to what is the difference between the two.

1

2 Answers

From man python:

-v Print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded. When given twice, print a message for each file that is checked for when searching for a module. Also provides information on module cleanup at exit.
-V , -version Prints the Python version number of the executable and exits.

Long story short

  1. python -v: when you execute python -v several modules will be loaded in anticipation of the work for which python is to do for you, python alone will get you the python prompt but will not show you the loaded modules and their file location, so python and python -v are in a way equivalent but the latter is more verbose as it shows what gets loaded and unloaded on exit. With this you can see what modules are available to you for work in python.

  2. python -V: simply just prints the version number and exits with no python prompt.

From man python:

 -v Print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded. When given twice, print a message for each file that is checked for when searching for a module. Also provides information on module cleanup at exit.

Cheers

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like