简体   繁体   中英

ModuleNotFoundError: pandas 1.3.5 with pyinstaller 4.10

I'm trying to compile a python script using pyinstaller and pyinstaller says " 10230 INFO: Building EXE from EXE-00.toc completed successfully" but when I execute the.exe file, I get a ModuleNotFoundError for pandas. I reduced the code to its simplest form:

    import pandas
    print('Hello Pandas')

I created a.spec file with a hidden import statement: # - - mode: python; coding: utf-8 - -

    block_cipher = None


    a = Analysis(['HelloPandas.py'],
         pathex=[],
         binaries=[],
         datas=[],
         hiddenimports=['pandas'],
         hookspath=[],
         hooksconfig={},
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher,
         noarchive=False)
    pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)

    exe = EXE(pyz,
      a.scripts,
      a.binaries,
      a.zipfiles,
      a.datas,  
      [],
      name='HelloPandas',
      debug=False,
      bootloader_ignore_signals=False,
      strip=False,
      upx=True,
      upx_exclude=[],
      runtime_tmpdir=None,
      console=True,
      disable_windowed_traceback=False,
      target_arch=None,
      codesign_identity=None,
      entitlements_file=None )

I have reinstalled pandas and pyinstaller. I'm running Windows 10, Python 3.7, pyinstaller 4.9, pandas 1.3.5 and MS Visual Studio Professional 2019, V16.6.2. I've also tried it with pyinstaller 3.6, 4.6 and 4.10 but had no joy.

Any suggestions on other steps to take are greatly appreciated.

I finally was able to sort this all out. It was tied to receiving a new laptop which had already been upgraded to Win 10, ver 20H2 and how it operates apparently differently than prior Windows versions. I typically work in Visual Studio 2019 and had installed the various Python modules needed using VS19 to develop my code.

For some reason, those modules were not recognized by PyInstaller as being present. As a result, I had to do a 'pip install' on any modules that PyInstaller didn't/couldn't recognize. The process was painful since I had to compile in PyInstaller, test the new.exe file and figure out the next module identified as being missing and iterate thru them all. It all ended well tho.

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