Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

What does running the command " python3 -v " in your terminal do? (lower case "v" i.e verbose)

I recently install python 3 via homebrew on my Mac, I wanted to find out the version of python that I was running so I typed in the command "python3 -v", but it gave me the code below:

import _frozen_importlib # frozen import _imp # builtin import sys # builtin import '_warnings' # <class '_frozen_importlib.BuiltinImporter'> import '_thread' # <class '_frozen_importlib.BuiltinImporter'> import '_weakref' # <class '_frozen_importlib.BuiltinImporter'> 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'>

installing zipimport hook

import 'zipimport' # <class '_frozen_importlib.BuiltinImporter'>

installed zipimport hook

/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/pycache/init.cpython-36.pyc matches /usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/init.py

code object from '/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/encodings/pycache/init.cpython-36.pyc'

/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pycache/codecs.cpython-36.pyc matches /usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/codecs.py

(NOTE: The above code is not the full code that was displayed, but just part of it.)

after the above happened I ran the command "exit()" which gave me the code below:

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

cleanup[2] removing builtins

cleanup[2] removing sys

cleanup[2] removing _frozen_importlib

cleanup[2] removing _imp

cleanup[2] removing _warnings

cleanup[2] removing _thread

cleanup[2] removing _weakref

cleanup[2] removing _frozen_importlib_external

cleanup[2] removing _io

cleanup[2] removing marshal

cleanup[2] removing posix

cleanup[2] removing zipimport

cleanup[2] removing encodings

destroy encodings

cleanup[2] removing codecs

cleanup[2] removing _codecs

cleanup[2] removing encodings.aliases

cleanup[2] removing encodings.utf_8

cleanup[2] removing _signal

cleanup[2] removing main

cleanup[2] removing encodings.latin_1

cleanup[2] removing io

destroy io

cleanup[2] removing abc

cleanup[2] removing _weakrefset

destroy _weakrefset

cleanup[2] removing site

destroy site

cleanup[2] removing os

cleanup[2] removing errno

cleanup[2] removing stat

cleanup[2] removing _stat

cleanup[2] removing posixpath

cleanup[2] removing genericpath

cleanup[2] removing os.path

cleanup[2] removing _collections_abc

cleanup[2] removing _sitebuiltins

cleanup[2] removing sysconfig

destroy sysconfig

cleanup[2] removing _sysconfigdata_m_darwin_darwin

destroy _sysconfigdata_m_darwin_darwin

cleanup[2] removing _osx_support

destroy _osx_support

cleanup[2] removing copyreg

cleanup[2] removing _bootlocale

destroy _bootlocale

cleanup[2] removing sitecustomize

destroy sitecustomize

cleanup[2] removing readline

cleanup[2] removing atexit

cleanup[2] removing rlcompleter

destroy rlcompleter

destroy zipimport

destroy _signal

destroy _sitebuiltins

destroy abc

destroy errno

destroy posixpath

destroy _stat

destroy genericpath

destroy stat

destroy os

destroy re

destroy enum

destroy sre_compile

destroy copyreg

destroy functools

destroy _locale

destroy atexit

destroy main

destroy readline

destroy _functools

destroy _collections_abc

(NOTE: The above code is not the full code that was displayed, but just part of it.)

because I'm new to programming, am not quite sure what I've done.

I just want to make sure that I haven't altered some of my system files by accidentally installing and delete important file, and that everything is okay?

I thought because I used Homebrew it would be contained in its own environment, so it couldn't affect the python that came installed with my Mac?

1 Answer

Steven Parker
Steven Parker
229,921 Points

Relax, you haven't changed your Python installation.

You just put it into verbose mode for that session, where it outputs debugging information for every internal step it performs. When you exit Python and run it again without that option, it should perform normally again.

Thanks a lot, really appreciate it