[英]ModuleNotFoundError: No module named 'pandas' when converting Python file to Executable using auto-py-to-exe
I used auto-py-to-exe to convert a Python script into an executable file and it converts it to an executable without any problems, but when I launch the executable the following error happens:我使用 auto-py-to-exe 将 Python 脚本转换为可执行文件,并将其转换为可执行文件而没有任何问题,但是当我启动可执行文件时会发生以下错误:
ModuleNotFoundError: No module named 'pandas' ModuleNotFoundError:没有名为“熊猫”的模块
[11084] Failed to execute script test1 [11084] 无法执行脚本 test1
Any ideas on how to fix this?有想法该怎么解决这个吗? I've tried many libraries to convert the Python file to and Executable and all give me the same error.我尝试了许多库来将 Python 文件转换为可执行文件,并且都给了我同样的错误。 I've tried with cx_Freeze, PyInstaller, py2exe, and auto-py-to-exe.我尝试过使用 cx_Freeze、PyInstaller、py2exe 和 auto-py-to-exe。 All give me a ModuleNotFoundError , but when I run the script on the IDE it runs perfectly.都给了我一个ModuleNotFoundError ,但是当我在 IDE 上运行脚本时,它运行得很好。
Are you trying pip install pandas
?你在尝试pip install pandas
吗?
A script that runs in your IDE but not outside may mean you are actually working in a virtual environment.在 IDE 中运行但不在外部运行的脚本可能意味着您实际上是在虚拟环境中工作。 Pandas probably is not installed globally in your system. Pandas 可能未在您的系统中全局安装。 Try remembering if you had created a virtual environment and then installed pandas inside this virtual environment.试着记住你是否创建了一个虚拟环境,然后在这个虚拟环境中安装了 pandas。
Hope it helped,希望有帮助,
Vijay.维杰。
For cx_freeze, inlcude pandas explicitly in the packages.对于 cx_freeze,在包中明确包含 pandas。 Like in the example below -就像下面的例子一样 -
build_exe_options = {'packages': ['os', 'tkinter', 'pandas']} build_exe_options = {'packages': ['os', 'tkinter', 'pandas']}
This should include the pandas module in you build.这应该包括您构建的 pandas 模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.