当将django应用程序转换为可执行文件时

时间:2019-07-03 13:16:59

标签: python django pyinstaller

我正在尝试将Visual Studio 2019中的Django项目转换为可执行文件。我正在使用pyInstaller,但一直在给我这个错误:TypeError:预期的str,字节或os.PathLike对象,而不是NoneType

我有一个虚拟环境,所有必要的软件包都在其中

我正在使用的命令是:

pyinstaller --name=mysite mysite/manage.py

An error for generating an exe file using pyinstaller - typeerror: expected str, bytes or os.PathLike object, not NoneType

此页面说明您需要进入pyInstaller的一个文件并将其替换为其他版本,但是我不知道如何打开pyInstaller的源代码在Visual Studio中无法做到这一点。

12034 INFO: Collecting Django migration scripts.
17330 INFO: Loading module hook "hook-encodings.py"...
17405 INFO: Loading module hook "hook-pkg_resources.py"...
17863 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
17923 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
17962 INFO: Loading module hook "hook-pydoc.py"...
17963 INFO: Loading module hook "hook-pyodbc.py"...
18018 INFO: Loading module hook "hook-pytz.py"...
18059 INFO: Loading module hook "hook-sqlite3.py"...
18166 INFO: Loading module hook "hook-sysconfig.py"...
18188 INFO: Loading module hook "hook-xml.dom.domreg.py"...
18189 INFO: Loading module hook "hook-xml.py"...
18191 INFO: Loading module hook "hook-django.db.backends.mysql.base.py"...
18196 INFO: Loading module hook "hook-django.db.backends.oracle.base.py"...
18287 INFO: Looking for ctypes DLLs
18345 INFO: Analyzing run-time hooks ...
18351 INFO: Including run-time hook 'pyi_rth_pkgres.py'
18368 INFO: Including run-time hook 'pyi_rth_django.py'
18397 INFO: Looking for dynamic libraries
19509 INFO: Looking for eggs
19509 INFO: Using Python library C:\Program Files (x86)\Microsoft Visual Studio\
Shared\Python37_64\python37.dll
19510 INFO: Found binding redirects:
[]
19539 INFO: Warnings written to C:\Users\source\repos\OfficeJobs\build\Dj
angoWebProject1\warn-DjangoWebProject1.txt
19739 INFO: Graph cross-reference written to C:\Users\source\repos\Office
Jobs\build\DjangoWebProject1\xref-DjangoWebProject1.html
20213 INFO: checking PYZ
20213 INFO: Building PYZ because PYZ-00.toc is non existent
20214 INFO: Building PYZ (ZlibArchive) C:\Users\source\repos\OfficeJobs\b
uild\DjangoWebProject1\PYZ-00.pyz
21417 INFO: Building PYZ (ZlibArchive) C:\Users\source\repos\OfficeJobs\b
uild\DjangoWebProject1\PYZ-00.pyz completed successfully.
21454 INFO: checking PKG
21454 INFO: Building PKG because PKG-00.toc is non existent
21455 INFO: Building PKG (CArchive) PKG-00.pkg
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\ru
npy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\ru
npy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\source\repos\OfficeJobs\office_proj_env\Scripts\pyinstal
ler.exe\__main__.py", line 9, in <module>
  File "c:\users\source\repos\officejobs\office_proj_env\lib\site-package
s\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\source\repos\officejobs\office_proj_env\lib\site-package
s\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\source\repos\officejobs\office_proj_env\lib\site-package
s\PyInstaller\building\build_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
  File "c:\users\source\repos\officejobs\office_proj_env\lib\site-package
s\PyInstaller\building\build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 29, in <module>
  File "c:\users\source\repos\officejobs\office_proj_env\lib\site-package
s\PyInstaller\building\api.py", line 424, in __init__
    strip_binaries=self.strip, upx_binaries=self.upx,
  File "c:\users\source\repos\officejobs\office_proj_env\lib\site-package
s\PyInstaller\building\api.py", line 196, in __init__
    self.__postinit__()
  File "c:\users\source\repos\officejobs\office_proj_env\lib\site-package
s\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\users\source\repos\officejobs\office_proj_env\lib\site-package
s\PyInstaller\building\api.py", line 273, in assemble
    pylib_name = os.path.basename(bindepend.get_python_library_path())
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\nt
path.py", line 214, in basename
    return split(p)[1]
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\nt
path.py", line 183, in split
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

C:\Users\source\repos\OfficeJobs>

是否有其他工具可以将Django项目转换为可执行文件?

0 个答案:

没有答案