I recently reinstalled my macOS and I wanted to check the version of Python. I typed python -v into the terminal and I am not sure what this did? I am new to the terminal and python programming. Did I install new software on accident?
Last login: Sun May 14 15:02:37 on ttys000 Matthews-MacBook-Pro:~ matthewkol$ python -v # installing zipimport hook import zipimport # builtin # installed zipimport hook # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import site # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import os # precompiled from /System/Library/Frameworks/ import errno # builtin import posix # builtin # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import posixpath # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import stat # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import genericpath # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import warnings # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import linecache # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import types # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import UserDict # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import _abcoll # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import abc # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import _weakrefset # precompiled from /System/Library/Frameworks/ import _weakref # builtin # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import copy_reg # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import traceback # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import sysconfig # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import re # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import sre_compile # precompiled from /System/Library/Frameworks/ import _sre # builtin # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import sre_parse # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import sre_constants # precompiled from /System/Library/Frameworks/ dlopen("/System/Library/Frameworks/", 2); import _locale # dynamically loaded from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import _sysconfigdata # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import _osx_support # precompiled from /System/Library/Frameworks/ import encodings # directory /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import encodings # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import codecs # precompiled from /System/Library/Frameworks/ import _codecs # builtin # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import encodings.aliases # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import encodings.utf_8 # precompiled from /System/Library/Frameworks/ Python 2.7.10 (default, Feb 6 2017, 23:53:20) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin Type "help", "copyright", "credits" or "license" for more information. dlopen("/System/Library/Frameworks/", 2); import readline # dynamically loaded from /System/Library/Frameworks/ >>> help Type help() for interactive help, or help(object) for help about object. >>> help(object) # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import pydoc # precompiled from /System/Library/Frameworks/ import imp # builtin # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import inspect # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import string # precompiled from /System/Library/Frameworks/ dlopen("/System/Library/Frameworks/", 2); import strop # dynamically loaded from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import dis # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import opcode # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import tokenize # precompiled from /System/Library/Frameworks/ dlopen("/System/Library/Frameworks/", 2); import itertools # dynamically loaded from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import token # precompiled from /System/Library/Frameworks/ dlopen("/System/Library/Frameworks/", 2); import operator # dynamically loaded from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import collections # precompiled from /System/Library/Frameworks/ dlopen("/System/Library/Frameworks/", 2); import _collections # dynamically loaded from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import keyword # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import heapq # precompiled from /System/Library/Frameworks/ dlopen("/System/Library/Frameworks/", 2); import _heapq # dynamically loaded from /System/Library/Frameworks/ import thread # builtin # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import pkgutil # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import repr # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import locale # precompiled from /System/Library/Frameworks/ # /System/Library/Frameworks/ matches /System/Library/Frameworks/ import functools # precompiled from /System/Library/Frameworks/ dlopen("/System/Library/Frameworks/", 2); import _functools # dynamically loaded from /System/Library/Frameworks/ >>> python -V Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'python' is not defined >>> exit Use exit() or Ctrl-D (i.e. EOF) to exit >>> ^D # clear __builtin__._ # clear sys.path # clear sys.argv # clear sys.ps1 # clear sys.ps2 # clear sys.exitfunc # clear sys.exc_type # clear sys.exc_value # clear sys.exc_traceback # 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.flags # clear sys.float_info # restore sys.stdin # restore sys.stdout # restore sys.stderr # cleanup __main__ # cleanup[1] _collections # cleanup[1] site # cleanup[1] sysconfig # cleanup[1] _heapq # cleanup[1] abc # cleanup[1] _weakrefset # cleanup[1] sre_constants # cleanup[1] collections # cleanup[1] _codecs # cleanup[1] opcode # cleanup[1] _warnings # cleanup[1] _sysconfigdata # cleanup[1] repr # cleanup[1] _osx_support # cleanup[1] readline # cleanup[1] strop # cleanup[1] _functools # cleanup[1] thread # cleanup[1] keyword # cleanup[1] signal # cleanup[1] traceback # cleanup[1] pydoc # cleanup[1] itertools # cleanup[1] posix # cleanup[1] exceptions # cleanup[1] _weakref # cleanup[1] token # cleanup[1] heapq # cleanup[1] locale # cleanup[1] functools # cleanup[1] encodings # cleanup[1] operator # cleanup[1] pkgutil # cleanup[1] zipimport # cleanup[1] inspect # cleanup[1] encodings.utf_8 # cleanup[1] imp # cleanup[1] codecs # cleanup[1] encodings.aliases # cleanup[1] dis # cleanup[1] tokenize # cleanup[1] string # cleanup[1] re # cleanup[1] _locale # cleanup[1] sre_compile # cleanup[1] _sre # cleanup[1] sre_parse # cleanup[2] copy_reg # cleanup[2] posixpath # cleanup[2] errno # cleanup[2] _abcoll # cleanup[2] types # cleanup[2] genericpath # cleanup[2] stat # cleanup[2] warnings # cleanup[2] UserDict # cleanup[2] os.path # cleanup[2] linecache # cleanup[2] os # cleanup sys # cleanup __builtin__ # cleanup ints: 21 unfreed ints # cleanup floats Matthews-MacBook-Pro:~ matthewkol$ 32 Answers
You didn't do anything wrong. From the man page for Python (accessed by 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. When given twice, print more information about the build. Think of the lowercase -v as "verbose"—it's useful for debugging modules. The modules you listed are all from the standard library.
This will show you the way your modules are loading for debugging reasons. (in this case it is just the base modules)
2