我做了一个简单的程序来制作书目,因为没有一个在线书目有我需要的格式。为了做到这一点,我安装了3个依赖python-docx,kivy和goose3。我使用pyinstaller将项目打包成一个可执行文件,当我运行可执行文件时,docx似乎可以工作并创建一个word文档,kivy运行得很好,但当我尝试webscrape时,goose3不能工作。
我尝试给pyinstaller提供站点包所在位置的路径,在virtualenv中安装依赖项,但似乎都不起作用。我在exe cmd提示符中不断收到以下错误:
During handling the above exception, another exception occurred:
...
File "C:\Users\prabh\OneDrive\Desktop\bib\dist\bib\my. kv", line 46, in <module>
on_press: root.search()
File "main.py", line 25, in search
article - g.extract(url-u)
File "goose3_init__.py", line 113, in extract
def repr_(self):
File "goose3 __init__.py", line 140, in _crawl
'context': ModuleContext()}
File "goose3\_init__.py", line 127, in crawler_
r_wrapper
if not os.path.exists(path):
File "goose3\crawler.py", line 116, in _init__
File "goose3\crawler.py", line 309, in get_image_extractor
File "goose3\extractors\images.py", line 57, in _init_
File "goose3\extractors\images.py", line 410, in load_customesite_mapping
File "goose3\utils l_init -py", line 46, in loadResourceFile
Only the name of the module followed by "-" is sufficient to activate the
OSError: Couldn't open file C:\Users\prabh\OneDrive\Desktop\bib\dist\bib\goose3\resources images\known-image-css.txt
[68940] Failed to execute script 'main' due to unhandled exception!在我的dist文件中似乎没有"goose3\resources images“文件夹。
发布于 2021-11-20 03:15:04
从this article中我发现问题出在PyInstaller没有在我的dist文件夹中创建goose3文件。
所以,我转到我的C:/驱动器,找到了我的集成开发环境(PyCharm)保存goose3文件夹的位置(通常在user/username/PyCharmProjects/项目名称/venv/Lib/site-packages/),然后简单地将该文件夹复制粘贴到dist应用程序文件夹(dist/app name/)
这解决了这个问题。
https://stackoverflow.com/questions/70042626
复制相似问题