ImportError: Couldn't import Django

前端 未结 22 1960
无人共我
无人共我 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 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.

提交回复
热议问题