[英]ModuleNotFoundError with pyinstaller but fine in Pycharm
I'm trying to convert a .py project to an .exe file using the using the Auto Py To Exe which uses the pyinstaller.我正在尝试使用使用 pyinstaller 的 Auto Py To Exe 将 .py 项目转换为 .exe 文件。
Running my code inside pycharm I get no errors.在 pycharm 中运行我的代码没有错误。 Running the .exe file i'm getting the error:运行 .exe 文件时出现错误:
Traceback (most recent call last):
File "objectGui.py", line 6, in <module>
ModuleNotFoundError: No module named 'scipy'
[19724] Failed to execute script objectGui
I've tried adding following bit of code to the conversion我试过在转换中添加以下代码
--hidden-import scipy
This does not change the error I keep getting.这不会改变我不断收到的错误。
Any suggestions?有什么建议?
I have found the solution in this post .我在这篇文章中找到了解决方案。
Since I worked on my project in an environment (PyCharm) I needed to type in the command in the PyCharm terminal for it to work.由于我在环境 (PyCharm) 中处理我的项目,因此我需要在 PyCharm 终端中输入命令才能使其工作。 I also added the hidden import:我还添加了隐藏的导入:
--hidden-import scipy
to find the module and it worked!找到模块并且它起作用了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.