在我完成Python脚本的制作之后,我想将我的脚本和使用的库捆绑起来,这样我就可以更容易地传播我的脚本
我试图使用PiInstaller,但我运行了在dist文件夹上生成的脚本,我发现模块bs4(未找到beautifullSoup)
我接着说:
我从使用命令“python3-m venv env»创建的虚拟环境目录运行piInstaller,如下所示:
$ /home/kfocal/.local/bin/pyinstaller podcast_apple.py
31 INFO: PyInstaller: 4.2
31 INFO: Python: 3.8.5
39 INFO: Platform: Linux-5.4.0-65-generic-x86_64-with-glibc2.29
42 INFO: wrote /home/focal/Documents/python/Kdata/env/podcast_apple.spec
45 INFO: UPX is not available.
47 INFO: Extending PYTHONPATH with paths
['/home/focal/Documents/python/Kdata/env',
'/home/focal/Documents/python/Kdata/env']
54 INFO: checking Analysis
54 INFO: Building Analysis because Analysis-00.toc is non existent
54 INFO: Initializing module dependency graph...
55 INFO: Caching module graph hooks...
58 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
60 INFO: Analyzing base_library.zip ...
2102 INFO: Processing pre-find module path hook distutils from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_find_module_path/hook-distutils.py'.
2103 INFO: distutils: retargeting to non-venv dir '/usr/lib/python3.8'
4053 INFO: Caching module dependency graph...
4137 INFO: running Analysis Analysis-00.toc
4160 INFO: Analyzing /home/focal/Documents/python/Kdata/env/podcast_apple.py
4235 INFO: Processing pre-safe import module hook six.moves from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-six.moves.py'.
5794 INFO: Processing module hooks...
5794 INFO: Loading module hook 'hook-certifi.py' from '/home/kfocal/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
5796 INFO: Loading module hook 'hook-cryptography.py' from '/home/kfocal/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
5949 INFO: Loading module hook 'hook-distutils.util.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
5952 INFO: Excluding import of lib2to3.refactor from module distutils.util
5952 INFO: Loading module hook 'hook-distutils.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
5954 INFO: Loading module hook 'hook-multiprocessing.util.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
5955 INFO: Excluding import of test from module multiprocessing.util
5955 INFO: Excluding import of test.support from module multiprocessing.util
5955 INFO: Loading module hook 'hook-xml.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
6004 INFO: Loading module hook 'hook-lib2to3.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
6011 INFO: Loading module hook 'hook-sysconfig.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
6021 INFO: Loading module hook 'hook-difflib.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
6024 INFO: Excluding import of doctest from module difflib
6024 INFO: Loading module hook 'hook-pickle.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
6025 INFO: Excluding import of argparse from module pickle
6025 INFO: Loading module hook 'hook-heapq.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
6027 INFO: Excluding import of doctest from module heapq
6027 INFO: Loading module hook 'hook-encodings.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
6064 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
6080 INFO: Looking for ctypes DLLs
6104 INFO: Analyzing run-time hooks ...
6107 INFO: Including run-time hook '/home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_multiprocessing.py'
6111 INFO: Including run-time hook '/home/kfocal/.local/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/rthooks/pyi_rth_certifi.py'
6121 INFO: Looking for dynamic libraries
6500 INFO: Looking for eggs
6500 INFO: Python library not in binary dependencies. Doing additional searching...
6546 INFO: Using Python library /lib/x86_64-linux-gnu/libpython3.8.so.1.0
6554 INFO: Warnings written to /home/focal/Documents/python/Kdata/env/build/podcast_apple/warn-podcast_apple.txt
6582 INFO: Graph cross-reference written to /home/focal/Documents/python/Kdata/env/build/podcast_apple/xref-podcast_apple.html
6591 INFO: checking PYZ
6591 INFO: Building PYZ because PYZ-00.toc is non existent
6591 INFO: Building PYZ (ZlibArchive) /home/focal/Documents/python/Kdata/env/build/podcast_apple/PYZ-00.pyz
7080 INFO: Building PYZ (ZlibArchive) /home/focal/Documents/python/Kdata/env/build/podcast_apple/PYZ-00.pyz completed successfully.
7084 INFO: checking PKG
7084 INFO: Building PKG because PKG-00.toc is non existent
7084 INFO: Building PKG (CArchive) PKG-00.pkg
7126 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
7127 INFO: Bootloader /home/kfocal/.local/lib/python3.8/site-packages/PyInstaller/bootloader/Linux-64bit/run
7127 INFO: checking EXE
7127 INFO: Building EXE because EXE-00.toc is non existent
7127 INFO: Building EXE from EXE-00.toc
7128 INFO: Appending archive to ELF section in EXE /home/focal/Documents/python/Kdata/env/build/podcast_apple/podcast_apple
7138 INFO: Building EXE from EXE-00.toc completed successfully.
7139 INFO: checking COLLECT
7139 INFO: Building COLLECT because COLLECT-00.toc is non existent
7140 INFO: Building COLLECT COLLECT-00.toc
7158 INFO: Building COLLECT COLLECT-00.toc completed successfully.
正如您所注意到的,一切似乎都很好,但我知道bs4模块丢失了
~/Documents/python/Kdata/env/dist/podcast_apple$ ./podcast_apple
Traceback (most recent call last):
File "podcast_apple.py", line 1, in <module>
ModuleNotFoundError: No module named 'bs4'
[81848] Failed to execute script podcast_apple
当我搜索«bs4»时,我只能在我的开发人员的lib中找到
~/Documents/python/Kdata/env$ find . -name "*bs4*"
./lib/python3.8/site-packages/bs4
./lib/python3.8/site-packages/bs4-0.0.1.egg-info
我错过什么了吗? 根据文档,piInstaller应该复制所有使用过的模块。为什么pyInstaller遗漏了bs4?Mon脚本非常简单
To find out, PyInstaller finds all the import statements in your script. It finds the imported modules and looks in them for import statements, and so on recursively, until it has a complete list of modules your script may use.
目前没有回答
相关问题 更多 >
编程相关推荐