UPDATE: I've now reset my .bash_profile
to this (based on this blog post):
PYTHONPATH="${PYTHONPATH}:/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/:$PATH"
export PYTHONPATH
After that, I tried source activate again and received this error:
Failed to import the site module
Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
PYTHONPATH is currently: ":/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/:/Users/name/anaconda/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/name/anaconda/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/name/bin:/usr/local/git/bin:/Library/TeX/texbin"
You should `unset PYTHONPATH` to fix this.
There is a major problem with this because that's not the PYTHONPATH set in my .bash_profile
... Now, I proceeded to execute PYTHONPATH=/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/
However, I'm still getting this error even though I'm pointing to a 3.4 directory:
Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
PYTHONPATH is currently: "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/"
You should `unset PYTHONPATH` to fix this.
Using unset PYTHONPATH
puts me in the same position noted below...
I use a macbook pro and typically operate with Python 3.X. Sometimes I need to use Python 2.7 and I have created an anaconda virtual environment to make it easy for me to do so. Since yesterday, I've started receiving 5 instances of the below error when trying to source activate
my Python 2 virtual env within the command line:
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
I executed the same command again as PYTHONVERBOSE=1 source activate python2
and located the Traceback (it's the same for each instance of the error):
Traceback (most recent call last):
File "/Users/name/anaconda/lib/python3.4/site.py", line 508, in execsitecustomize
import sitecustomize
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, 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 "/Users/name/anaconda/lib/python3.4/os.py", line 635, in __getitem__
raise KeyError(key) from None
KeyError: 'PYTHONPATH'
Does anyone know how I may go about fixing this? I don't want to adjust any files before I fully know what I'm doing.