Pyinstaller - ImportError: No system module 'pywintypes' (pywintypes27.dll)

前端 未结 8 806
温柔的废话
温柔的废话 2021-01-11 18:03

I am trying to package my python script into an executable. I thought I would be pretty straight forward as I don\'t have very many imports. First off here are my imports:

8条回答
  •  长情又很酷
    2021-01-11 18:48

    Solution to prob 2. The solution in the link below solved the issue for me :)

    With pywin32 build 219 installed via conda on python 2.7, importing pythoncom fails with

    ImportError: No system module 'pywintypes' (pywintypes27.dll)
    

    The issue is that the library pywintypes27.dll is stored not in

    pathtovenv\lib\site-packages\win32\lib\pywintypes27.dll

    but in

    pathtovenv\lib\site-packages\win32\pywintypes27.dll

    Adding in the file win32\lib\pywintypes.py the elif part herebelow solves the issue

    :::python

    if found is None:
        # Not in the Python directory?  Maybe we were installed via
        # easy_install...
        if os.path.isfile(os.path.join(os.path.dirname(__file__), filename)):
            found = os.path.join(os.path.dirname(__file__), filename)
        elif os.path.isfile(os.path.join(os.path.dirname(__file__), "..", filename)):
            found = os.path.join(os.path.dirname(__file__), "..", filename)
    

    In short terms it looks like pywintypes27.dll is located in the wrong folder

    http://sourceforge.net/p/pywin32/bugs/685/

提交回复
热议问题