PyInstaller无法创建base_library.zip

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PyInstaller无法创建base_library.zip相关的知识,希望对你有一定的参考价值。

我是python的新手我通常使用PyInstaller将文件.py转换为.exe这是正常的工作这次我想像以前一样转换我的.py文件但出现错误14037错误:无法创建base_library.zip!

...................................................... .........

C:Program FilesPython38>pyinstaller "HPFSERVER_with _mysql .py"
138 INFO: PyInstaller: 3.6
139 INFO: Python: 3.8.2
139 INFO: Platform: Windows-10-10.0.18362-SP0
142 INFO: wrote C:Program FilesPython38HPFSERVER_with _mysql .spec
144 INFO: UPX is not available.
148 INFO: Extending PYTHONPATH with paths
['C:\Program Files\Python38', 'C:\Program Files\Python38']
149 INFO: checking Analysis
149 INFO: Building Analysis because Analysis-00.toc is non existent
150 INFO: Initializing module dependency graph...
155 INFO: Caching module graph hooks...
202 INFO: Analyzing base_library.zip ...
6268 INFO: Processing pre-find module path hook   distutils
6431 INFO: distutils: retargeting to non-venv dir 'c:\program files\python38\lib'
13892 INFO: Caching module dependency graph...
14037 ERROR: base_library.zip could not be created!
Traceback (most recent call last):
  File "c:program filespython38lib
unpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:program filespython38lib
unpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:UserssatthaAppDataRoamingPythonPython38Scriptspyinstaller.exe\__main__.py", line 7, in <module>
  File "C:UserssatthaAppDataRoamingPythonPython38site-packagesPyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:UserssatthaAppDataRoamingPythonPython38site-packagesPyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:UserssatthaAppDataRoamingPythonPython38site-packagesPyInstalleruildinguild_main.py", line 734, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "C:UserssatthaAppDataRoamingPythonPython38site-packagesPyInstalleruildinguild_main.py", line 681, in build
    exec(code, spec_namespace)
  File "C:Program FilesPython38HPFSERVER_with _mysql .spec", line 6, in <module>
    a = Analysis(['HPFSERVER_with _mysql .py'],
  File "C:UserssatthaAppDataRoamingPythonPython38site-packagesPyInstalleruildinguild_main.py", line 244, in __init__
    self.__postinit__()
  File "C:UserssatthaAppDataRoamingPythonPython38site-packagesPyInstalleruildingdatastruct.py", line 160, in __postinit__
    self.assemble()
  File "C:UserssatthaAppDataRoamingPythonPython38site-packagesPyInstalleruildinguild_main.py", line 352, in assemble
    create_py3_base_library(libzip_filename, graph=self.graph)
  File "C:UserssatthaAppDataRoamingPythonPython38site-packagesPyInstallerdependutils.py", line 68, in create_py3_base_library
    with zipfile.ZipFile(libzip_filename,mode = 'w') as zf:
  File "c:program filespython38libzipfile.py", line 1251, in __init__
    self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Program Files\Python38\build\HPFSERVER_with _mysql \base_library.zip'

...................................................... .................

Ps。我的程序内部有os,pymysql库,如果有帮助非常感谢。

答案

感谢Legorooj先生,我现在可以将.py转换为.exe!如何解决这个问题1.只需将整个代码复制到.py文件中2.创建新的.py文件3.将您从旧.py文件复制的代码粘贴到新文件中。4.使用pyinstaller转换新文件:D

以上是关于PyInstaller无法创建base_library.zip的主要内容,如果未能解决你的问题,请参考以下文章

PyInstaller Winerror3:系统无法找到指定的路径

ImportError: 当使用pyinstaller创建一个.exe时,无法导入名称'pywrap_tensorflow'。

PyInstaller 无法更改快捷方式图标

Kivy,Python:我无法减小 PyInstaller 生成的包的大小

解决pyinstaller打包过程中外部资源无法加载的问题 ...

Pyinstaller Qt5 应用程序无法在 Windows 10 中启动