from django.utils.importlib import import_module ImportError: No module named importlib

删除回忆录丶 提交于 2020-11-29 09:41:57

问题


I am new to Django. I got a Django rest project. When i run it, an error shows as

from django.utils.importlib import import_module
ImportError: No module named importlib

I tried installing importlib with the command

pip install importlib

Then it shows

Requirement already satisfied: importlib in ./lib/python2.7/site-packages/gcm/utils.py"

So how coild i install importlib package?


回答1:


You don't. importlib is part of python since v2.7. The project you want to run seems to be an old project that still uses the compatibility module provided by old Django versions for when it supported python 2.6. It's been obsolete since Django 1.7. That means it's twofold outdated.

Replace all occurences of django.utils.importlib with importlib. But the project being clearly outdated, you will probably run into many other issues.



来源:https://stackoverflow.com/questions/44299495/from-django-utils-importlib-import-import-module-importerror-no-module-named-im

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!