问题
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