Skip to content Skip to sidebar Skip to footer

Pythonpath Error When Trying To Activate A Virtual Environment

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/:

Solution 1:

it looks like your PYTHONPATH is no longer set on your system, and the code is assuming that there is -something- in the environment.

I believe you could set a blank path in mac using the following; keep in mind if your python3.4 relies on the system path this may be dangerous! WARNING!: I am not on a mac, so you might need to give some string on the right-hand side here, otherwise it might not save the key

export PYTHONPATH=

If you do not want to set anything system-wide, you could simply add the variable to the running python scripts before sitecustomize runs. Buildout allows you to do this with a pre-script (via zc.buildout or zc.recipes, I am sure Anaconda has something similar), and this would allow the PYTHONPATH to be different for 3.4 and 2.7, which is what you're trying to do in the first place:

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

Post a Comment for "Pythonpath Error When Trying To Activate A Virtual Environment"