ImportError: cannot import name memoize 1.8-1.9
ImportError: cannot import name memoize 1.8-1.9
我有一个错误:
Invalid template library specified. ImportError raised when trying to load 'crispy_forms.templatetags.crispy_forms_field': cannot import name memoize
降级到 1.8 没有帮助
它适用于 Ubuntu 14.04,但不适用于 Win10
- Python2.7
- Django1.9
- django-crispy-forms==1.4.0
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Internet\DJANG\django19\django19\newsletter\views.py", line 45, in home
return render(request, "newsletter/home.html", context)
File "C:\Python27\lib\site-packages\django\shortcuts.py", line 67, in render
template_name, context, request=request, using=using)
File "C:\Python27\lib\site-packages\django\template\loader.py", line 96, in render_to_string
template = get_template(template_name, using=using)
File "C:\Python27\lib\site-packages\django\template\loader.py", line 26, in get_template
engines = _engine_list(using)
File "C:\Python27\lib\site-packages\django\template\loader.py", line 143, in _engine_list
return engines.all() if using is None else [engines[using]]
File "C:\Python27\lib\site-packages\django\template\utils.py", line 110, in all
return [self[alias] for alias in self]
File "C:\Python27\lib\site-packages\django\template\utils.py", line 101, in __getitem__
engine = engine_cls(params)
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 31, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 49, in get_templatetag_libraries
libraries = get_installed_libraries()
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 131, in get_installed_libraries
for name in get_package_libraries(pkg):
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 148, in get_package_libraries
"trying to load '%s': %s" % (entry[1], e)
InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'crispy_forms.templatetags.crispy_forms_field': cannot import name memoize
[12/May/2016 18:26:17] "GET / HTTP/1.1" 500 109450
Crispy forms 1.4 已过时。
如果您查看 crispy forms changelog,您可以看到何时添加了对不同 Django 版本的兼容性。
对于 Django 1.8,您需要安装 crispy forms 1.5 或更高版本。
对于 Django 1.9,您需要安装 crispy forms 1.6 或更高版本。
您的 django-crispy-forms 版本已过时,已修复。按 运行 更新:
pip 安装 django-crispy-forms -U
我有一个错误:
Invalid template library specified. ImportError raised when trying to load 'crispy_forms.templatetags.crispy_forms_field': cannot import name memoize
降级到 1.8 没有帮助
它适用于 Ubuntu 14.04,但不适用于 Win10
- Python2.7
- Django1.9
- django-crispy-forms==1.4.0
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Internet\DJANG\django19\django19\newsletter\views.py", line 45, in home
return render(request, "newsletter/home.html", context)
File "C:\Python27\lib\site-packages\django\shortcuts.py", line 67, in render
template_name, context, request=request, using=using)
File "C:\Python27\lib\site-packages\django\template\loader.py", line 96, in render_to_string
template = get_template(template_name, using=using)
File "C:\Python27\lib\site-packages\django\template\loader.py", line 26, in get_template
engines = _engine_list(using)
File "C:\Python27\lib\site-packages\django\template\loader.py", line 143, in _engine_list
return engines.all() if using is None else [engines[using]]
File "C:\Python27\lib\site-packages\django\template\utils.py", line 110, in all
return [self[alias] for alias in self]
File "C:\Python27\lib\site-packages\django\template\utils.py", line 101, in __getitem__
engine = engine_cls(params)
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 31, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 49, in get_templatetag_libraries
libraries = get_installed_libraries()
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 131, in get_installed_libraries
for name in get_package_libraries(pkg):
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 148, in get_package_libraries
"trying to load '%s': %s" % (entry[1], e)
InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'crispy_forms.templatetags.crispy_forms_field': cannot import name memoize
[12/May/2016 18:26:17] "GET / HTTP/1.1" 500 109450
Crispy forms 1.4 已过时。
如果您查看 crispy forms changelog,您可以看到何时添加了对不同 Django 版本的兼容性。
对于 Django 1.8,您需要安装 crispy forms 1.5 或更高版本。
对于 Django 1.9,您需要安装 crispy forms 1.6 或更高版本。
您的 django-crispy-forms 版本已过时,已修复。按 运行 更新:
pip 安装 django-crispy-forms -U