PyInstaller 可执行文件:ModuleNotFoundError - Pandas
背景: 我有一个 .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
-
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用此命令行编译 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