How to install win32com.client on Python 3.4 or Python 2.7

Jen picture Jen · Dec 28, 2017 · Viewed 46.6k times · Source

I tried to install win32com.client using the syntax below, but no success

>>> pip install pywin32

SyntaxError: invalid syntax

>>> pypiwin32

Traceback (most recent call last): File "", line 1, in pypiwin32 NameError: name 'pypiwin32' is not defined

>>> pip install pypiwin32

SyntaxError: invalid syntax

>>> pip install pypiwin32-220-cp36-none-win32.whl

SyntaxError: invalid syntax

Answer

pylang picture pylang · Dec 28, 2017

Those errors suggest you are inside a Python environment. For example, the Python REPL starts with three chevrons, >>>. You don't want this. Run these commands outside of Python in the system command prompt either through Windows or Linux etc.

The following worked for me on Python 2.7:

> pip install pypiwin32

Also try the following from this post:

> python -m pip install pypiwin32