[英]Pyinstaller with Django: ModuleNotFoundError: No Module Named django.contrib.messages.apps
I'm trying to run my packaged python application in the cmd line, and I get the error: 我试图在cmd行中运行打包的python应用程序,但出现错误:
ModuleNotFoundError: No Module Named 'django.contrib.messages.apps'
I used the answer from https://github.com/pyinstaller/pyinstaller/issues/2332 to get rid of the similar error for 'django.contrib.admin.apps'
, so does anyone know how to remove this one as well? 我使用了https://github.com/pyinstaller/pyinstaller/issues/2332中的答案来摆脱
'django.contrib.admin.apps'
的类似错误,所以有人知道如何也删除该错误吗?
I have the same problem with Django 2.0.4
. 我对
Django 2.0.4
有同样的问题。 Seems like it does not supports latest versions of Django. 似乎它不支持Django的最新版本。 The problem is that PyInstaller can't resolve hidden imports, so you have to add them to hooks manually.
问题是PyInstaller无法解析隐藏的导入,因此您必须手动将它们添加到挂钩中。 Edit
.spec
file, which is created after first build with pyinstaller
, fill array of hidden_imports
with missing packages and make build pointing .spec
file instead of manage.py
. 编辑
.spec
文件,该文件是在使用pyinstaller
首次构建后创建的,使用缺少的软件包填充了hidden_imports
数组,并使构建指向.spec
文件而不是manage.py
。 Unfortunelly, after adding few packages, new errors appears. 不幸的是,添加了几个软件包之后,出现了新的错误。
https://pythonhosted.org/PyInstaller/when-things-go-wrong.html https://pythonhosted.org/PyInstaller/when-things-go-wrong.html
Pyinstaller
works fine with Django 1.8 , so try using this version.
Pyinstaller
可以在Django 1.8上 Pyinstaller
工作,因此请尝试使用此版本。 Project based on Django 1.8 builds successfully, and runs well using runserver
基于Django 1.8的项目可以成功构建,并且可以通过
runserver
运行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.