【问题标题】:how to properly install django-import-export如何正确安装 django-import-export
【发布时间】:2019-11-25 19:49:06
【问题描述】:

我正在尝试将 excel 表导入到我的 django 数据库中,并且我设法安装了 django-import-export。在此 https://simpleisbetterthancomplex.com/packages/2016/08/11/django-import-export.html 之后,我编辑了 settings.py 以包含“import-export”,但我不断收到一个错误,即没有名为“import-export”的模块。

https://simpleisbetterthancomplex.com/packages/2016/08/11/django-import-export.html 之后,我编辑了 settings.py 以包含“import-export”,但是当我尝试运行服务器时,我不断收到一个错误,即没有名为“import-export”的模块。

ModuleNotFoundError: 没有名为“import-export”的模块

在此之后我也不太确定我的后续步骤。

【问题讨论】:

  • 你能用“pip freeze”显示已安装的包来验证安装吗?
  • astroid==2.2.5 backports.csv==1.0.7 colorama==0.4.1 defusedxml==0.6.0 diff-match-patch==20181111 Django==2.2.3 django- import-export==1.2.0 et-xmlfile==1.0.1 isort==4.3.21 jdcal==1.4.1lazy-object-proxy==1.4.1 mccabe==0.6.1 mysqlclient==1.4.2 odfpy==1.4.0 openpyxl==2.6.2 pylint==2.3.1 pytz==2019.1 PyYAML==5.1.1 六==1.12.0 sqlparse==0.3.0 tablib==0.13.0 typed-ast= =1.4.0 wrapt==1.11.2 xlrd==1.2.0 xlwt==1.3.0

标签: django import export


【解决方案1】:

我认为您的INSTALLED_APPS 中有错字

编辑您的INSTALLED_APPS。使用import_export 而不是import-export

# settings.py
INSTALLED_APPS = (
    ...
    'import_export',
)

请参考docs

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-06-30
    • 2023-03-28
    • 2016-04-19
    • 2021-11-14
    • 1970-01-01
    • 1970-01-01
    • 2012-08-26
    相关资源
    最近更新 更多