nucklehedd
nucklehedd

Reputation: 301

Problems with PYTHONPATH

From the command line (Mac OS), when I execute 'echo $PYTHONPATH' I get:

> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7

If I then enter the Python interpreter and do the following:

>>> import os
>>> os.environ['PYTHONPATH']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'PYTHONPATH'

Why would this happen?

Upvotes: 1

Views: 1682

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799310

You forgot to export it to the environment so that subprocesses can access it; it's currently only a bash variable.

export PYTHONPATH

Upvotes: 3

Related Questions