Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I cannot figure out why my python installation is not using the PYTHONPATH environment variable. I'm running Python 3.3 on Mac OS X 10.9.2. Here's my PYTHONPATH and the problem that it doesn't show up in sys.path.

~$ echo $PYTHONPATH
/path/to/dir
~$ python
Python 3.3.3 (default, Dec 30 2013, 23:51:18) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/Cellar/python3/3.3.3...', ..., '/usr/local/Cellar/python3/3.3.3/...']

Any clue where to start looking for a solution?

share|improve this question
3  
What is the output of python -c 'import inspect; import site; print inspect.getfile(site)'? The site module is supposed to read PYTHONPATH, but there may be another that is shadowing the one in site-packages. –  SethMMorton May 13 at 17:35
    
python -c 'import inspect; import site; print(inspect.getfile(site))' outputs /usr/local/Cellar/python3/3.3.3/Frameworks/Python.framework/Versions/3.3/lib/pyt‌​hon3.3/site.py –  JeremyKun May 13 at 17:38
    
If you do a grep PYTHONPATH on that file, do you get a hit? Is there also a /usr/local/Cellar/python3/3.3.3/Frameworks/Python.framework/Versions/3.3/lib/py‌​t‌​hon3.3/site-packages/site.py? –  SethMMorton May 13 at 17:38
2  
Why would one downvote this? It's a legitimate question. –  SethMMorton May 13 at 17:39
    
No hits on grep for the first file, but the second gives what looks like the right code for appending PYTHONPATH. What is going on here? –  JeremyKun May 13 at 17:41
show 10 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.