我想构建一个独立的可执行 VLI 工具,它将使用 pyfiglet 包。当我运行它时,文件pyinstaller --onefile main.py中出现了一些警告。build/warn-main.txt.
我已经更改了生成的 main.spec,添加"pyfiglet.fonts"了一些其他缺失的模块,然后执行了pyinstaller --onefile main.spec. 之后只有 pyfiglet.fonts 被“解决”了。
最初我在 Windows 10 Pro 中运行代码,但由于我没有找到解决方案,我安装了一个干净的带有 linux 和 python 的 VM,只是为了测试......
我在一个干净的 ubuntu 19.04 安装上运行: - 从默认存储库安装 python3 (3.7.3) - 没有虚拟环境 - 添加 - 安装的 pyinstaller (3.5) 简单如pip install pyinstaller
有了这个非常基本的代码,问题就会发生
import pyfiglet
print("Basic Work...")
ascii_banner = pyfiglet.figlet_format("Works...")
print(ascii_banner)
缺少的模块是:
missing module named pyimod03_importers - imported by /home/masterlocal/.local/lib/python3.7/site-packages/PyInstaller/loader/rthooks/pyi_rth_pkgres.py (top-level)
missing module named _winreg - imported by platform (delayed, optional), /home/masterlocal/code/cliexe/main.py (top-level), pkg_resources._vendor.appdirs (delayed, conditional)
missing module named java - imported by platform (delayed), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named 'java.lang' - imported by platform (delayed, optional), /home/masterlocal/code/cliexe/main.py (top-level), xml.sax._exceptions (conditional)
missing module named vms_lib - imported by platform (delayed, conditional, optional), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named org - imported by pickle (optional), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named msvcrt - imported by subprocess (conditional), click._compat (conditional, optional), click._winconsole (top-level), getpass (optional), click._termui_impl (conditional), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named _winapi - imported by encodings (delayed, conditional, optional), subprocess (conditional), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named winreg - imported by platform (delayed, optional), mimetypes (optional), /home/masterlocal/code/cliexe/main.py (top-level), urllib.request (delayed, conditional, optional), pkg_resources._vendor.appdirs (delayed, conditional)
missing module named pkg_resources.extern.six - imported by pkg_resources.extern (top-level), pkg_resources (top-level), pkg_resources.py31compat (top-level), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named 'pkg_resources.extern.six.moves' - imported by pkg_resources (top-level), /home/masterlocal/code/cliexe/main.py (top-level), pkg_resources._vendor.packaging.requirements (top-level)
missing module named pkg_resources.extern.appdirs - imported by pkg_resources.extern (top-level), pkg_resources (top-level), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named pkg_resources.extern.packaging - imported by pkg_resources.extern (top-level), pkg_resources (top-level), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named __main__ - imported by pkg_resources (delayed, optional), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named 'pkg_resources.extern.pyparsing' - imported by pkg_resources._vendor.packaging.requirements (top-level), pkg_resources._vendor.packaging.markers (top-level)
missing module named 'ctypes.macholib' - imported by ctypes.util (conditional)
missing module named netbios - imported by uuid (delayed)
missing module named win32wnet - imported by uuid (delayed)
missing module named __builtin__ - imported by pkg_resources._vendor.pyparsing (conditional)
missing module named ordereddict - imported by pkg_resources._vendor.pyparsing (optional)
missing module named 'win32com.shell' - imported by pkg_resources._vendor.appdirs (conditional, optional)
missing module named 'com.sun' - imported by pkg_resources._vendor.appdirs (delayed, conditional, optional)
missing module named com - imported by pkg_resources._vendor.appdirs (delayed)
missing module named win32api - imported by pkg_resources._vendor.appdirs (delayed, conditional, optional)
missing module named win32com - imported by pkg_resources._vendor.appdirs (delayed)
missing module named StringIO - imported by pkg_resources._vendor.six (conditional)
missing module named nt - imported by os (conditional, optional), ntpath (conditional, optional), shutil (conditional), /home/masterlocal/code/cliexe/main.py (top-level)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), /home/masterlocal/code/cliexe/main.py (top-level)
missing module named 'org.python' - imported by copy (optional), /home/masterlocal/code/cliexe/main.py (top-level), xml.sax (delayed, conditional)
missing module named colorama - imported by click._compat (conditional, optional)
我是 Python 新手,所以没有太多关于如何操作的经验,但是根据我阅读的许多帖子,没有太多细节。我已经检查了有关如何安装和要求的文档,并且所有内容(不多)都符合预期。
我将不胜感激任何帮助。