ImportError:在执行python3 manage.py migration时无法导入名称'memoize'

时间:2019-06-10 04:24:43

标签: python django python-3.x

我在使用python3 manage.py migrate的Django中进行迁移时遇到了问题,它向我展示了memoize

我已经安装了django-memoize并将其包含在我的settings.py中,但是它仍然显示错误。

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/apps/registry.py", line 122, in populate
    app_config.ready()
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/contrib/admin/apps.py", line 24, in ready
    self.module.autodiscover()
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/mycomputer/.local/lib/python3.6/site-packages/adminsortable/admin.py", line 15, in <module>
    from django.shortcuts import render
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/shortcuts/__init__.py", line 14, in <module>
    from django.core import urlresolvers
  File "/home/mycomputer/.local/lib/python3.6/site-packages/django/core/urlresolvers.py", line 19, in <module>
    from django.utils.functional import memoize, lazy
ImportError: cannot import name 'memoize'

安装备忘录后应该已经迁移了。

1 个答案:

答案 0 :(得分:0)

感谢您提供的所有支持,我需要安装一些依赖项并重新安装python,然后创建虚拟环境并安装依赖项。