Loading
2017. 12. 11. 18:43 - leee.sangwon

pyinstaller pandas 오류


다음과 같은 오류가 발생하며 pyinstaller로 생성한 exe가 실행 되지않음


https://stackoverflow.com/questions/29109324/pyinstaller-and-pandas


block_cipher = None

def get_pandas_path():
    import pandas
    pandas_path = pandas.__path__[0]
    return pandas_path

a = Analysis(['Hello.py'],
         pathex=['C:\\ScriptsThatRequirePandas'],
         binaries=None,
         datas=None,
         hiddenimports=[],
         hookspath=None,
         runtime_hooks=None,
         excludes=None,
         win_no_prefer_redirects=None,
         win_private_assemblies=None,
         cipher=block_cipher)

dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
a.datas += dict_tree
a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)

pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)
exe = EXE(pyz,
      a.scripts,
      exclude_binaries=True,
      name='Hello',
      debug=False,
      strip=None,
      upx=True,
      console=True )

위와 같이 pandas 처리하는 코드를 .spec 파일에 추가


pyinstaller -F myApp.spec으로 build