在 ubuntu/trusty64 中运行时,“python -v”和“python -V”有什么区别?

roh*_*mar 2 python

我正在尝试确定 python 版本,但是当我使用小写“v”运行命令 python -V 时,我发现我已移至 python 提示符,而不是仅返回 python 版本。我尝试找出两者之间的区别,但找不到任何有用的东西。请大家指点一下两者有什么区别。

Geo*_*sen 6

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.
Run Code Online (Sandbox Code Playgroud)

长话短说

  1. python -v:当您执行时,将加载python -v几个modules预期的 python 将为您做的工作,python单独将为您提供 python 提示符,但不会显示加载的模块及其文件位置,因此pythonpython -v在某种程度上是等效的,但是后者更详细,因为它显示了 getsloadedunloadedon 的内容exit。通过这个,你可以看到哪些模块可供你在 python 中工作。

  2. python -V:只是打印版本号并退出,没有 python 提示符。