PyInstaller 可执行文件:ModuleNotFoundError - Pandas

发布于 2025-01-17 06:07:52 字数 862 浏览 4 评论 0原文

背景: 我有一个 .py 脚本,它使用 c.10 库/依赖项(例如 pandas numpy < code>json),并且该脚本还依赖于 .ini 文件,它会在其所在的同一目录中查找该文件。

我想添加此内容.py 文件发送到 Windows Scheduler,但之前我可以,我必须使该文件可执行。

问题:我使用PyInstaller创建了一个可执行文件。我还在创建 .exe 文件时添加了 -- onefile-w 。我的问题是,当我尝试运行 main.exe(通过双击或通过 cmd)时,我收到以下脚本中未处理的异常代码> -

“输入图像描述这里"

帮助:我试图了解这是如何发生的,特别是因为我对 PyInstaller 的理解是它会创建一个可执行文件,这将公司脚本运行所需的所有内容(注意:我已经仔细检查了 .py 是否包含 import pandas 等。

有人可以向我解释一下我将如何解决此问题和/或如果我可能明显错过了任何关键步骤,这可能导致此问题?

Background: I have a .py script which uses c.10 libraries/dependencies (e.g., pandas numpy json) and the script also relies on a .ini file, which it looks for in the same dir as it is located.

I want to add this .py file to Windows Scheduler, but before I can, I must make the file executable.

Issue: I used PyInstaller to create an executable file. I also added -- onefile and -w when creating the .exe file. My issue is that when I attempt to run the main.exe (either by double-clicking or through cmd) I get the following Unhandled exception in script -

enter image description here

Help: I am trying to understand how this is happening, especially as my understanding of PyInstaller is that it would create an executable file, which would inc. everything the script needs to run (Note: I have double checked that the .py contains import pandas etc.

Can someone explain to me how I would troubleshoot this and/or if there are any key steps I may have obviously missed, which might be causing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七分※倦醒 2025-01-24 06:07:52

尝试使用此命令行编译 python 文件,pyinstaller.exe --onefile --noconsole --hidden-import pandas {Your_FILE_NAME}.py

Try using this commandline for compiling your python file, pyinstaller.exe --onefile --noconsole --hidden-import pandas {Your_FILE_NAME}.py

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文