无法使用pyinstaller创建可执行文件

时间:2020-01-23 13:36:05

标签: python pyinstaller

我正在udemy上学习python类,我学习了如何制作应用程序并使用pyinstaller创建一个exe文件。尝试为python脚本创建exe文件时,出现以下错误。我不确定是什么原因造成的。前两行是我按下Enter键之前终端中的内容。无论我输入什么路径,或者尝试使用哪个脚本,它都不会起作用。我询问了udemy,但没有得到答案。我从来没有在这里问过一个问题,所以请原谅我是否遗漏了一些东西。每次尝试时,它始终以“ win32ctypes.pywin32.pywintypes.error:(1920,'LoadLibraryExW','文件无法被系统访问。”)结尾。

我安装了虚拟环境,但也无法弄清楚如何在虚拟环境中执行此操作。

PS C:\ Users \ Jtaylor \ Desktop \ Blank \ Python> pyinstaller --onefile --windowed C:\ Users \ Jtaylor \ Desktop \ Blank \ Python \ App5BookDatabase \ App5BooksF.py

67 INFO: PyInstaller: 3.6

75 INFO: Python: 3.7.6

76 INFO: Platform: Windows-10-10.0.18362-SP0

78 INFO: wrote C:\Users\Jtaylor\Desktop\Blank\Python\App5BooksF.spec

81 INFO: UPX is not available.

88 INFO: Extending PYTHONPATH with paths

['C:\\Users\\Jtaylor\\Desktop\\Blank\\Python\\App5BookDatabase',

'C:\\Users\\Jtaylor\\Desktop\\Blank\\Python']

96 INFO: checking Analysis

98 INFO: Building Analysis because Analysis-00.toc is non existent

98 INFO: Initializing module dependency graph...

106 INFO: Caching module graph hooks...

121 INFO: Analyzing base_library.zip ...

3069 INFO: Caching module dependency graph...

3188 INFO: running Analysis Analysis-00.toc

Traceback (most recent call last):

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error

    yield

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx

    return _dll._LoadLibraryEx(fileName, 0, flags)

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\win32ctypes\core\ctypes\_util.py", line 42, in check_null

    raise make_error(function, function_name)

OSError: [WinError 1920] The file cannot be accessed by the system.



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 193, in _run_module_as_main

    "__main__", mod_spec)

  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 85, in _run_code

    exec(code, run_globals)

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\__main__.py", line 114, in run

    run_build(pyi_config, spec_file, **vars(args))

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\__main__.py", line 65, in run_build

    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\building\build_main.py", line 734, in main

    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\building\build_main.py", line 681, in build

    exec(code, spec_namespace)

  File "C:\Users\Jtaylor\Desktop\Blank\Python\App5BooksF.spec", line 17, in <module>

    noarchive=False)

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\building\build_main.py", line 244, in __init__

    self.__postinit__()

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__

    self.assemble()

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\building\build_main.py", line 395, in assemble

    redirects=self.binding_redirects)[1:])

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\depend\bindepend.py", line 228, in Dependencies

    for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\depend\bindepend.py", line 404, in getAssemblyFiles

    for assembly in getAssemblies(pth):

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\depend\bindepend.py", line 355, in getAssemblies

    res = GetManifestResources(pth)

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1007, in GetManifestResources

    return winresource.GetResources(filename, [RT_MANIFEST], names, languages)

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\PyInstaller\utils\win32\winresource.py", line 170, in GetResources

    hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx

    return _dll._LoadLibraryEx(fileName, 0, flags)

  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 130, in __exit__

    self.gen.throw(type, value, traceback)

  File "C:\Users\Jtaylor\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error

    raise error(exception.winerror, exception.function, exception.strerror)

win32ctypes.pywin32.pywintypes.error: (1920, 'LoadLibraryExW', 'The file cannot be accessed by the system.')

0 个答案:

没有答案