python - PYTHONPATH error when trying to activate a virtual environment -


update: i've reset .bash_profile (based on this blog post):

pythonpath="${pythonpath}:/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/:$path" export pythonpath 

after that, tried source activate again , received error:

failed import site module pythonpath points site-packages dir python 2.x running python 3.x!      pythonpath 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"      should `unset pythonpath` fix this. 

there major problem because that's not pythonpath set in .bash_profile... now, proceeded execute pythonpath=/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/

however, i'm still getting error though i'm pointing 3.4 directory:

your pythonpath points site-packages dir python 2.x running python 3.x!      pythonpath currently: "/library/frameworks/python.framework/versions/3.4/lib/python3.4/site-packages/"      should `unset pythonpath` fix this. 

using unset pythonpath puts me in same position noted below...


i use macbook pro , typically operate python 3.x. need use python 2.7 , have created anaconda virtual environment make easy me so. since yesterday, i've started receiving 5 instances of below error when trying source activate python 2 virtual env within command line:

error in sitecustomize; set pythonverbose traceback: keyerror: 'pythonpath' 

i executed same command again pythonverbose=1 source activate python2 , located traceback (it's same each instance of 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 currently: "' + str(os.environ['pythonpath']) + '"\n' +   file "/users/name/anaconda/lib/python3.4/os.py", line 635, in __getitem__     raise keyerror(key) none keyerror: 'pythonpath' 

does know how may go fixing this? don't want adjust files before know i'm doing.

it looks pythonpath no longer set on system, , code assuming there -something- in environment.

i believe set blank path in mac using following; keep in mind if python3.4 relies on system path may dangerous! warning!: not on mac, might need give string on right-hand side here, otherwise might not save key

export pythonpath= 

if not want set system-wide, add variable running python scripts before sitecustomize runs. buildout allows pre-script (via zc.buildout or zc.recipes, sure anaconda has similar), , allow pythonpath different 3.4 , 2.7, you're trying in first place:

import os pypath = os.environ.get("pythonpath", "") os.environ["pythonpath"] = pypath 

Comments