How to Convert to an exe File Using Pandas

Asked 2 years ago, Updated 2 years ago, 45 views


Use py2exe to create a file that uses pandas in the code. I compiled it into an exe file, but I can't run it.
The exe file is created just in case, but the file size is unusually large.
If you run it, you will get the following error:

 OMP:Warning #178:Function GetModuleHandleEx failed:
OMP:System error#126—The specified module cannot be found.
Traceback (most recent call last):
  File "hogehoge.py", line 7, in <module>
    import pandas aspd
  File "zipextimporter.pyc", line82, inload_module
  File "pandas\_init__.pyc", line 49, in<module>
  File "zipextimporter.pyc", line82, inload_module
  File "pandas\core\api.pyc", line 9, in <module>
  File "zipextimporter.pyc", line82, inload_module
  File "pandas\core\groupby.pyc", line 15, in <module>
  File "zipextimporter.pyc", line82, inload_module
  File "pandas\core\frame.pyc", line 39, in <module>
  File "zipextimporter.pyc", line82, inload_module
  File "pandas\core\series.pyc", line 2702, in<module>
  File "zipextimporter.pyc", line82, inload_module
  File "pandas\tools\plotting.pyc", line 27, in<module>
  File "zipextimporter.pyc", line82, inload_module
  File "pandas\tseries\converter.pyc", line 7, in <module>
  File "zipextimporter.pyc", line82, inload_module
  File "matplotlib\_init__.pyc", line 1100, in<module>
  File "matplotlib\_init__.pyc", line 947, inrc_params
  File "matplotlib\_init__.pyc", line 789, in matplotlib_fname
  File "matplotlib\_init__.pyc", line 325, in wrapper
  File "matplotlib\_init__.pyc", line 693, in_get_data_path_cached
  File "matplotlib\_init__.pyc", line 661, in_get_data_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 43: original
 not in range (128)

The setup.py you used is as follows:

 from distutils.core import setup
import py2exe, sys, os

sys.argv.append('py2exe')

setup(
    options={'py2exe':{'bundle_files':1}},
    zipfile=None,
    console=[{'script':"hogehoge.py"}]
)

I think I need to add something to setup.py.
I'm a beginner, so I haven't solved it yet.

I also tried pyinstaller, but it seems that something is missing, so I'm in trouble.

It would be very helpful if you could give me some advice.

python pandas

2022-09-29 22:35

1 Answers

Pandas seems to have a lot of dependencies, so I don't know much about it, but there have been cases where it doesn't work when I put everything together in exe.Because py2exe is hard to prepare a variety of programs, executing the following command on pyinstaller should create an exe in the folder called dist in the working directory:

pyinstaller hogehoge.py


2022-09-29 22:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.