问题解决FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEImHg8uh/django/contrib/auth/pas

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/luopeiyuan1990/article/details/86551628

django 在 pyinstaller 安装时很多问题。如题是问题

报错为:

Unhandled exception in thread started by <function check_errors..wrapper at 0x7fd66513ef28>
Traceback (most recent call last):
File "django/utils/autoreload.py", line 225, in wrapper
File "/tmp/_MEImHg8uh/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "django/utils/autoreload.py", line 248, in raise_last_exception
File "django/core/management/init.py", line 337, in execute
File "django/utils/autoreload.py", line 225, in wrapper
File "django/init.py", line 24, in setup
File "django/apps/registry.py", line 112, in populate
File "django/apps/config.py", line 198, in import_models
File "importlib/init.py", line 126, in import_module
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "/home/leo/.local/lib/python3.5/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.dict)
File "django/contrib/auth/models.py", line 2, in 
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "/home/leo/.local/lib/python3.5/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.dict)
File "django/contrib/auth/base_user.py", line 7, in 
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "/home/leo/.local/lib/python3.5/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.dict)
File "django/contrib/auth/password_validation.py", line 160, in 
File "django/contrib/auth/password_validation.py", line 170, in CommonPasswordValidator
File "pathlib.py", line 1109, in resolve
File "pathlib.py", line 330, in resolve
File "pathlib.py", line 315, in _resolve
File "pathlib.py", line 422, in readlink
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEImHg8uh/django/contrib/auth/password_validation.pyc'

为了解决这个问题,我还去github提了issue,最后自己找到方法并mark一下:

 

https://github.com/pyinstaller/pyinstaller/issues/3990

django 版本固定到 2.0

pyinstaller -F manage.py --hidden-import django --hidden-import rest_framework --hidden-import rest_framework.apps --hidden-import redis --hidden-import rest_framework.parsers --distpath ./

 

 

没有更多推荐了,返回首页