Installed Django with Pip, but Python couldn't find it
I am trying to install django, but I am not sure how. I think I have django installed, but python python can't seem to use the package.
$ sudo pip install django Requirement already satisfied (use --upgrade to upgrade): django in /usr/local/lib/python2.7/site-packages Cleaning up... $ python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named django
How to fix it? When I try to start the server I get this error
$ python manage.py runserver Traceback (most recent call last): File "manage.py", line 8, in <module> from django.core.management import execute_from_command_line ImportError: No module named django.core.management
source to share
using a different Python version than yours
. Check the output of these commands:
pip -V python -V python -c 'import sys; print(sys.path)'
There may be multiple versions of Python and Pip on your system. For example, in Bash, if you type
+ Tabmultiple times, it will show you the available Python binaries on your PATH, for example
and similarly for
It depends on your system how to properly configure so that both
use the same versions.
Based on the command output, it
uses Python 2.7. One quick fix might be to start Django like this:
python2.7 manage.py runserver
Or to run the version
corresponding to your default Python version.
This "quick fix" is a dirty fix. It would be better to use virtualenv.
source to share