pyinstaller& django OSError:[Errno 2]没有这样的文件或目录

时间:2016-06-15 09:08:06

标签: python django pyinstaller

我正在尝试使用pyinstaller编译django Web应用程序。 我使用了以下命令:

 /usr/local/python2.7/bin/pyinstaller --name=zhaobiao ./zbproject/manage.py

当我执行编译的exe时,它给了我以下错误:

    [root@smon zhaobiao]# ./dist/zhaobiao/zhaobiao runserver 0.0.0.0:8000
Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x7f5220297410>
Traceback (most recent call last):
  File "site-packages/django/utils/autoreload.py", line 226, in wrapper
  File "site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
  File "site-packages/django/core/management/commands/runserver.py", line 163, in check_migrations
  File "site-packages/django/db/migrations/executor.py", line 20, in __init__
  File "site-packages/django/db/migrations/loader.py", line 49, in __init__
  File "site-packages/django/db/migrations/loader.py", line 170, in build_graph
  File "site-packages/django/db/migrations/loader.py", line 98, in load_disk
OSError: [Errno 2] No such file or directory: '/root/Downloads/dist/zhaobiao/zbapp/migrations'

然后我在以下位置找到迁移目录:

[root@smon zhaobiao]# find . -iname 'migrations'
./django/contrib/admin/migrations
./django/contrib/auth/migrations
./django/contrib/sessions/migrations
./django/contrib/sites/migrations
./django/contrib/redirects/migrations
./django/contrib/contenttypes/migrations
./django/contrib/flatpages/migrations
./django/conf/app_template/migrations

所以路径不匹配,我该怎么办?

1 个答案:

答案 0 :(得分:0)

我已将目录/ root / Downloads / zbproject / zbapp复制到/ root / Downloads / dist / zhaobiao /

现在可行。

[root@smon test]# ./dist/zhaobiao/zhaobiao runserver 0.0.0.0:8000
Performing system checks...

System check identified no issues (0 silenced).
May 30, 2016 - 03:04:49
Django version 1.9.5, using settings 'zhaobiao.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.