Reputation: 163
I was postponing this question since i am not sure this is the right place to ask it. But i don't find a clear answer either.
I am running pycharm 2018.1.4, on windows and it seems that i can't change the virtual env that running in the terminal in pycharm. When i check the python version in the terminal i get version 2.7.3, for the project interpreter i have python 3.6 and for my run configurations i have the same 3.6 interpreter. There are no problems running the development server or anything like that, just in the terminal i can't run the manage.py script without getting following.
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?
I understand the error, i just dont get why it is using that virtuals env instead of the one configured as project interpreter. Anyone else stumbled upon this problem?
Upvotes: 1
Views: 2394
Reputation: 668
Of course, if there is the dependency on Django, you can just type
pip install django
Upvotes: 0
Reputation: 1610
It can be due to various reasons, You can try the following command once the virtualenv is activated
python --version
If it shows python 2.7 as the version then it means in your system you have given python command to respond to the 2.7 version. Its more like a name tag.
Try python3 --version
and it should give you back "Python 3.6".
If that's the case, then use python3 manage.py runserver
and it should work perfectly
Upvotes: 0
Reputation: 74
As far as i know, Pycharm's terminal is not bound to Project Interpreter and the IDE related features. To make it work, you'll have to manually activate your virtualenv in the terminal.
Upvotes: 1