I think this got foobarred when I was doing some brew update stuff. Everytime my system python3 is called, it emits:
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
This is particularly annoying because I use powerline in my terminal and powerline makes several calls to python each time I execute a command.
Calling Python3 with a the Verbose flag I get:
$ PYTHONVERBOSE=True python3
<multiple pages of python startup info...>
# possible namespace for /usr/local/lib/python2.7/site-packages/backports
# bytecode is stale for 'sitecustomize'
# code object from /usr/local/lib/python2.7/site-packages/sitecustomize.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 481, in execsitecustomize
import sitecustomize
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/usr/local/lib/python2.7/site-packages/sitecustomize.py", line 15, in <module>
str(sys.version_info[0]) + '.x!\n PYTHONPATH is currently: "' + str(os.environ['PYTHONPATH']) + '"\n' +
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 669, in __getitem__
raise KeyError(key) from None
KeyError: 'PYTHONPATH'
# destroy sitecustomize
import 'site' # <_frozen_importlib_external.SourceFileLoader object at 0x101e3a630>
<more python startup info...>
So the system Python3 is trying to load the Python2 version of sitecustomize? I suspect that's the problem. If so, what are my options for fixing this? brew unlink python3 && brew link python3
didn't help.
I'm not sure what the bytecode is stale for 'sitecustomize'
comment python is making is about, but I've also removed the sitecustomize.pyc file, which didn't help.