I'm using Mac 10.13.6 with Python 3.7. I use PyCharm for development. Although I can run commands fine in the PyCharm management console, when I try and run the same commands in a terminal, I get errors complaining taht I don't have Django installed. For instance
localhost:mainpage_project davea$ python manage.py runstats
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
Perhaps I defined my PYTHONPATH incorrectly, but I set it to my Python executable
localhost:mainpage_project davea$ which python
/usr/local/bin/python
localhost:mainpage_project davea$ echo $PYTHONPATH
/usr/local/bin/python
What should be the value of PYTHONPATH? I'm able to run the command fine within PyCharm, it's only in the terminal that things start throwing errors.