简体   繁体   中英

Django - No Module named 'django'

I recently installed Django and below is the installation path

C:\\Program Files (x86)\\Python Software Foundation\\Python\\Lib\\site-packages\\

I added the path to the PATH environment variable and I tried django-admin command in the cmd prompt. I am getting the below error:

'django-admin' is not recognized as an internal or external command, operable program or batch file.

Whereas if I go into the django's bin folder and issue the same django-admin command, I am getting the below error

Traceback (most recent call last): File "C:\\Program Files (x86)\\Python Software Foundation\\Python\\Lib\\site-packag es\\django\\bin\\django-admin.py", line 2, in from django.core import management ImportError: No module named 'django'

All I want is for Django to create a website for me inside the project folder that I have created. Any help on how to fix this will help me started with Django.

I would recommend you to install django within virtual environment.

Follow these steps for ubuntu:

  1. Choose/make a folder mkdir DjangoProjects
  2. Inside that folder install virtualenv by:

    pip install virtualenv .

  3. Active environment as:

    source ./bin/activate

  4. Install Django as :

    pip install django

It will install the latest version of django

Now You can verify that the installation was successful by typing:

django-admin --version

It must show : 1.10.5

For windows OS read follow this tut: https://tutorial.djangogirls.org/en/installation/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM