0

I'm using Django and Python 3.7 on Mac High Sierra. I'm having an issue when trying to run my unit tests. Following teh advice here -- Python (Windows) - ImportError: No module named site , I set my $PYTHONHOME and $PYTHONPATH

localhost:mainpage_project davea$ echo $PYTHONHOME
/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7
localhost:mainpage_project davea$ echo $PYTHONPATH
/usr/local/bin/python
localhost:mainpage_project davea$ 

Not sure why I need to do this since I'm using a virtual environment. Nonetheless, when I run the tests, I get

localhost:mainpage_project davea$ ./manage.py test
ImportError: No module named site

I'm at a loss for other variables I need to set in order to proceed.

Dave
  • 15,639
  • 133
  • 442
  • 830
  • Your `$PYTHONPATH` is wrong. It must be set to a **library** directory, not to a binary. Something like `export PYTHONPATH=/usr/local/lib/python3.7`. In a virtualenv you don't need `PYTHONPATH` at all. – phd Feb 14 '19 at 01:10

0 Answers0