PyInstaller does not recognize downloaded pywin32
Asked Answered
O

3

8

I have downloaded Python 2.7.3, PyInstaller (compatible with 2.7) and pywin32 (compatible with 2.7) and restarted my machine, but when I enter the prompt:

pyinstaller.py [opts] nameofscript.py

The prompt then tells me:

Error: PyInstaller for Python 2.6+ on windows needs pywin32. Please install from http://sourceforge.net/projects/pywin32/

Why is it that PyInstaller can't "see" that I have already downloaded pywin32?

Omnidirectional answered 5/2, 2013 at 22:44 Comment(0)
E
2

If you are using Python 2.7, the compat.py in the C:/Python27/Lib/site-packages/PyInstaller file need to be changed to:

if is_win:
try:
    #from win32ctypes.pywin32 import pywintypes  # noqa: F401
    #from win32ctypes.pywin32 import win32api
    import pywintypes
    import win32api
except ImportError:
    # This environment variable is set by seutp.py
    # - It's not an error for pywin32 to not be installed at that point
    if not os.environ.get('PYINSTALLER_NO_PYWIN32_FAILURE'):
        raise SystemExit('PyInstaller cannot check for assembly dependencies.\n'
                         'Please install PyWin32 or pywin32-ctypes.\n\n'
                         'pip install pypiwin32\n')

in order to work.

Englishry answered 5/12, 2018 at 20:1 Comment(0)
K
1

Got it! Found this useful tutorial:

http://bojan-komazec.blogspot.ca/2011/08/how-to-create-windows-executable-from.html

The 3rd paragraph tells you the how to get around the problem. The link he points to is tricky though. You need to go here to get the pywin32 installer.

http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/

Kalmick answered 26/4, 2013 at 17:33 Comment(1)
Note that there is a pywin32 package available on PyPI these days which allows simple installation using pip instead.Kreitman
S
0

You should install pywin32 to the Python path first and then verify if it has succeeded by running this Python command:

import win32com

if there is no error, pywin32 is installed.

Small answered 7/11, 2014 at 1:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.