简体   繁体   中英

How to resolve ModuleNotFoundError: No module named 'pandas'

I have this script that I originally created in Jupyter Notebooks and I saved it later on as a.py file, then I used auto-py-to-exe to convert it to an exe file. When it runs it gives me this error:

ModuleNotFoundError: No module named 'pandas' [23712] Failed to execute script due to unhandled exception!

It's importing pandas in at the top of the script, and I had used pip install to install pandas, and I thought I had all of my python --path variables set correctly, but clearly something still isn't set right. Is this an issue of looking at the wrong directory?

This is apparently a somewhat common issue with auto-py-to-exe . I'd suggest reading through this blog post by the author for solutions to this and many other issues. If you skip to here , the suggested solution is as follows:

ModuleNotFoundError: No module named x / ImportError: No module named x

This means a particular module ('x' in this case) was not added to the package. I have seen this occur with packages in the pandas library and win32api; as long as you can identify the package (eg 'x'), then it is very easy to fix.

To fix this in the UI, open the advanced tab and find the --hidden-import input. Simply paste the module name into this input and then repackage. If the original error is still appearing, you have done this incorrectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM