zoukankan      html  css  js  c++  java
  • 出错

    ModuleNotFoundError: No module named ‘haystack’

    找到settings,将

    HAYSTACK_CONNECTIONS = {
        'default': {
            'ENGINE': 'haystack.backends.whoosh_cn_backend.WhooshEngine',
            'PATH': os.path.join(BASE_DIR, 'whoosh_index'),
        }
    }

    改为

    HAYSTACK_CONNECTIONS = {
        'default': {
            'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
            'PATH': os.path.join(BASE_DIR, 'whoosh_index'),
        }
    }

    因为python的django框架在2.0版本以上已经不存在whoosh_cn_backend

    下载django-haystack 2.8.1

    https://pypi.org/project/django-haystack/#files
    在这里插入图片描述
    将安装包解压到python下的Lib目录下,进入django-haystack-2.8.1,会看到set.py,
    在命令行进入set.py目录下输入pip install django-haystack,下面表示安装成功

    在这里插入图片描述

    ImportError: cannot import name ‘six’ from ‘django.utils’

    (C:UsersDELLAppDataLocalProgramsPythonPython37libsite-packagesdjango-3.0.4-py3.7.eggdjangoutils_init_.py)

    原因

    django 3.x 系列删除了six.

    解决办法

    第一步:安装six,尽量在d:目录下(我的是:D:programpython3python(2)Lib
    第二步:
    C:UsersDELLAppDataLocalProgramsPythonPython37Libsite-packages

    cd #进入家目录
    cd .local/lib/python3.6/site-packages
    cp six.py django/utils #将six.py拷贝进django/utils/目录下Django-3.0.4-py3.7.eggdjangoutils

    第三步:
    C:UsersDELLAppDataLocalProgramsPythonPython37Libsite-packageshaystack

    # 将site-packages/haystack/inputs.py 中
    from django.utils.encoding import force_text, python_2_unicode_compatible
    # 改为
    from django.utils.encoding import force_text
    from django.utils.six import python_2_unicode_compatible
    # 问题解决

    django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?

    django.core.exceptions.improperyconfigured:加载MySQLdb模块时出错。
    你安装了mysqlclient吗?

    安装mysqlclient

    在这里插入图片描述
    将安装包解压到python下的Lib目录下,进入mysqlclient-1.4.6,会看到set.py,
    在命令行进入set.py目录下输入pip install mysqlclient,下面表示安装成功

    在这里插入图片描述

    from moviepy.editor import VideoFileClip ModuleNotFoundError: No module named ‘moviepy’

    安装moviepy

    https://pypi.org/project/moviepy/#files
    在这里插入图片描述
    将安装包解压到python下的Lib目录下,进入moviepy-1.0.2,会看到set.py,
    在命令行进入set.py目录下输入pip install moviepy,下面表示安装成功

    安装numpy 1.18.2

    https://pypi.org/project/numpy/#files
    在这里插入图片描述
    在这里插入图片描述
    numpy-1.18.2
    将安装包解压到python下的Lib目录下,进入numpy-1.18.2,会看到set.py,
    在命令行进入set.py目录下输入pip install numpy,下面表示安装成功
    在这里插入图片描述

    from django.contrib.staticfiles.templatetags.staticfiles import static ModuleNotFoundError: No module named ‘django.contrib.staticfiles.templatetags’

    ( File “D:programpython3Django_learningElearn-masterext_appsxadminutil.py”, line 24, in )

    util.py

    与其从这里导入它:from django.contrib.staticfiles.templatetags.staticfiles import static,还需要从这里导入它:from django.templatetags.static import static

    ModuleNotFoundError: No module named ‘django.contrib.formtools’

    下载安装django-formtools 2.2

    https://pypi.org/project/django-formtools/#files
    在这里插入图片描述
    将安装包解压到python下的Lib目录下,进入django-formtools-2.2,会看到set.py,
    在命令行进入set.py目录下输入pip install django-formtools,下面表示安装成功
    在这里插入图片描述

    ModuleNotFoundError: No module named ‘httplib2’

    下载httplib2 0.17.0

    https://pypi.org/project/httplib2/#files
    在这里插入图片描述

    将安装包解压到python下的Lib目录下,进入httplib2-0.17.0,会看到set.py,
    在命令行进入set.py目录下输入pip install httplib2,下面表示安装成功
    在这里插入图片描述

    ModuleNotFoundError: No module named ‘import_export’

    下载django-import-export-2.0.2

    https://pypi.org/project/django-import-export/#files
    在这里插入图片描述
    将安装包解压到python下的Lib目录下,进入django-import-export-2.0.2,会看到set.py,
    在命令行进入set.py目录下输入pip install django-import-export,下面表示安装成功
    在这里插入图片描述
    在这里插入图片描述

    ModuleNotFoundError: No module named ‘captcha’

    https://github.com/mbi/django-simple-captcha

    将安装包解压到python下的Lib目录下,进入django-simple-captcha-master,会看到set.py,
    在命令行进入set.py目录下输入pip install django-simple-captcha,下面表示安装成功

    在这里插入图片描述

    haystack.exceptions.MissingDependency: The ‘whoosh’ backend requires the installation of ‘Whoosh’. Please refer to the documentation.

    下载安装Whoosh 2.7.4

    https://pypi.org/project/Whoosh/#files

    在这里插入图片描述
    将安装包解压到python下的Lib目录下,进入Whoosh-2.7.4,会看到set.py,
    在命令行进入set.py目录下输入pip install Whoosh,下面表示安装成功
    在这里插入图片描述

  • 相关阅读:
    WP开发笔记——页面传参
    WP开发笔记——控件倾斜效果
    WP开发笔记——不同Item显示不同ApplicationBar:适用于Pivot与Panorama
    WP开发笔记——WP APP添加页面跳转动画
    WP开发笔记——去除 HTML 标签
    WP开发笔记——字符串 转 MD5 加密
    WP开发笔记——WP7 SDK使用技巧
    sphinx,coreseek安装
    yii2从零开始一,安装
    array_filter函数
  • 原文地址:https://www.cnblogs.com/llb123/p/13398706.html
Copyright © 2011-2022 走看看