Python version on mac & weird terminal behavior
I wanted to find out what version on Python was installed on my mac. Instead of typing "python -V" I typed "python -v". I got the following output which is just a snippet of what the terminal output.
# installing zipimport hook import zipimport # builtin # installed zipimport hook # /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py import site # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.pyc # /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py import os # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.pyc import errno # builtin import posix # builtin
I've not seen this. What is it doing? After this it goes the the Python "prompt". When I type "exit()" it does this.
# 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
Again, this is just a small sample of my terminal output. It then quits Python.
[MOD: added ```bash markdown formatting -cf]
Chris FreemanTreehouse Moderator 52,994 Points
All is well. You're just getting a peak behind the curtain....
-v : verbose (trace import statements); also PYTHONVERBOSE=x can be supplied multiple times to increase verbosity -V : print the Python version number and exit (also --version)
The lower-cased v is for
verbose. What you are seeing are all the
import statements python runs to setup the interactive session. The same verosity is shown on the
exit. Because I frequently mixed these two up, I usually type out