I've got my project set up under a native virtual environment in 3.4 and have had it that way for a while and had it working fine. But for some reason, I am now having issues with running my project through Pycharm. Just to check that everything was set up properly, I did the following:
>>> import sys
>>> sys.path
>>> import django
I can confirm that PROJECT/lib/python3.4/site-packages
is included in the path and that Django is installed in this path.
However, when I attempt to run the project through Pycharm I get ImportError: No module named 'django'
. I added the following to the Django's manage.py to troubleshoot:
sys.stdout.write(', '.join(sys.path))
The site-packages
directory is nowhere to be found. Next, I went to "Settings > Project Interpreter" to make sure I had the correct interpreter chosen. It lists Python 3.4 under the virtual environment and includes Django as the first of the installed packages.
My question, what the heck, Pycharm? The virtual environment is clearly set up correctly. The path is correct from the python terminal and Pycharm itself recognizes all the packages from the virtual environment under it's project interpreter section. Why then, when I actually run the project, does Pycharm stupidly decide to forget to run the project using the virtual environment and not use the correct python path? Little frustrated here. Would appreciate any suggestions.