ImportError: Couldn't import Django

前端 未结 22 1803
无人共我
无人共我 2020-12-05 01:59

I\'ve already configured virtualenv in pycharm, when using the python manage.py command, this is error shown:

E:\\video course\\Python\\code\\web_worker\\MxO         


        
相关标签:
22条回答
  • 2020-12-05 02:58

    you need to go to the root directory and run the below command

    source bin/activate
    

    Once the above command is executed, you will be able to create custom apps

    0 讨论(0)
  • 2020-12-05 03:00

    I faced the same issue, and in my case it was because I had multiple python versions on my machine, in addition to the Anaconda ones. In my case django didn't worked well with my anaconda python. I knew that when I run import django on each python terminal for all versions I have.

    As a summary here are the steps I made to get this solved:

    1. Run the CMD as Admin

    2. Create a project folder.

    3. Create a new ENV for this new project INSIDE THE PROJECT Folder...

      pip install virtualenv >> virtualenv new_env`
      
    4. Activate it:

      .\new_env\Scripts\activate`
      
    5. After the env activation ⇒ Install Django:

      python -m pip install Django
      

    The python version you used here in step 5 will determine which python will to work with this installed Django.

    0 讨论(0)
  • 2020-12-05 03:01

    You need to use both commands: pip install django and pip3 install django that worked for me

    0 讨论(0)
  • 2020-12-05 03:01

    I also face the same problem in windows 10 with anaconda For me anaconda3\Scripts>activate

    it's working good. What you have to do you just need to go to anaconda home

    AppData\Local\Continuum\anaconda3\Scripts

    and you need to open a cmd prompt and type activate.

    It will activate the venv for you.

    0 讨论(0)
提交回复
热议问题