简体   繁体   中英

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

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?

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.

As suggested in the comments the importlib is part of django-appconf which is later deprecated. You need to install approriate version of django-appconf.

pip install django-appconf==1.0.2 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM