为什么在终端中输入“python3 -v”后会出现此输出?

csh*_*hif 6 python terminal

我以为输入后可以获得python3的版本

python3 -v
Run Code Online (Sandbox Code Playgroud)

在终端。相反,我得到了这些:

import _frozen_importlib # frozen
import _imp # builtin
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
# installing zipimport hook
import 'zipimport' # <class '_frozen_importlib.BuiltinImporter'>
# installed zipimport hook
import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
import '_io' # <class '_frozen_importlib.BuiltinImporter'>
import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
import 'posix' # <class '_frozen_importlib.BuiltinImporter'>
import _thread # previously loaded ('_thread')
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import _weakref # previously loaded ('_weakref')
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
# /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/encodings/__pycache__/__init__.cpython-37.pyc matches /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/encodings/__init__.py
# code object from '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/encodings/__pycache__/__init__.cpython-37.pyc'
# /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/__pycache__/codecs.cpython-37.pyc matches /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/codecs.py
Run Code Online (Sandbox Code Playgroud)

之后,我输入

exit()
Run Code Online (Sandbox Code Playgroud)

离开,显示

# clear builtins._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# clear sys.__interactivehook__
# clear sys.flags
# clear sys.float_info
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
Run Code Online (Sandbox Code Playgroud)
  1. 有人可以解释一下输出的含义吗?
  2. 他们为什么会出现?

小智 6

Python 的 -v 选项代表“详细”,这意味着它会打印解释器中发生的情况的详细调试信息。尝试man pythonman python3查看手册页。它表明版本是通过选项--version(或-V简称)获取的。