ImportError: Couldn't import Django

前端 未结 22 1899
无人共我
无人共我 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:51

    I solved this problem in a completely different way.

    Package installer = Conda (Miniconda)
    List of available envs = base, djenv(Django environment created for keeping project related modules).
    

    When I was using the command line to activate the djenv using conda activate djenv, the base environment was already activated. I did not notice that and when djenv was activated, (djenv) was being displayed at the beginning of the prompt on the command line. When i tired executing , python manage.py migrate, this happened.
    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 deactivated the current environment, i.e conda deactivate. This deactivated djenv. Then, i deactivated the base environment.
    After that, I again activated djenv. And the command worked like a charm!!

    If someone is facing a similar issue, I hope you should consider trying this as well. Maybe it helps.

提交回复
热议问题