10

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

Mika Sundland
  • 18,120
  • 16
  • 38
  • 50
Jen
  • 143
  • 1
  • 2
  • 7

3 Answers3

10

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
pylang
  • 40,867
  • 14
  • 129
  • 121
  • Thanks, I got error message as below. But I can get on to https://pypi.python.org/pypi from the internet explorer. C:\Users\n0266997\AppData\Local\Programs\Python\Python36-32>python -m pip instal l pypiwin32 Collecting pypiwin32 Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connec tion broken by 'ConnectTimeoutError(, 'Connection to pypi.python. org timed out. (connect timeout=15)')': /simple/pypiwin32/ – Jen Dec 28 '17 at 21:58
  • That's a better sign that you are actually using pip. I'd try again a bit later as the connection to pypi via pip can be unrealiable at times. You may also consider [updating your pip](https://stackoverflow.com/questions/15221473/how-do-i-update-pip-itself-from-inside-my-virtual-environment). If you are considering Python long-term, I'd strongly suggest installing Python again via [Anaconda](https://www.anaconda.com/download/?lang=en-us) and creating a new conda environment. – pylang Dec 28 '17 at 23:10
  • I tried to update PIP using the command below, still get the connection error. Is there a way I can download win32com.client and manually install it myself? C:\Users\n0266997\AppData\Local\Programs\Python\Python36-32>python -m pip instal l -U pip Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connecti on broken by 'ConnectTimeoutError(, 'Connection to pypi.python.or g timed out. (connect timeout=15)')': /simple/pip/ – Jen Dec 28 '17 at 23:23
  • I used the commend python -m pip install pypiwin32 on python 2.711. It connects, but gives me error message: Could not find a version that satisfies the requirement pypiwin32 (from versio ns: ) No matching distribution found for pypiwin32 – Jen Dec 29 '17 at 00:01
  • I experienced a similar issue a few days ago, but today I was able to install it in my Python 2 environment. You may have an odd python installation or pypi is not working well at the moment. Best advice I have is try again later. – pylang Dec 29 '17 at 00:07
  • If you try the Anaconda route in the meantime, it is easy to make a virtualenv via `conda create pywin python=2.7`, then `conda pywin` (`activate pywin` in older versions). This will be a self-contained virtual environment that protects your root installation from being corrupted by some bad package installation. – pylang Dec 29 '17 at 00:09
  • pypiwin32 is more a dummy package than a real package. It requires the pywin32>=223. This means you must find a pywin32 in pypi, which means there is no need for this package if you already can find a pywin32. And in pypi in the pywin32 there are no wheels for python 3.4 So... – ilias iliadis Nov 12 '19 at 07:52
3

Install the package via command prompt or Terminal of your python IDE(ex: PyCharm)

pip install pywin32
RITA KUSHWAHA
  • 351
  • 3
  • 7
0

first command work for me somehow.........

C:\Users\AL MARUF>pip install pypiwin32
Collecting pypiwin32
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x032A8C70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/pypiwin32/
  Downloading https://files.pythonhosted.org/packages/d0/1b/2f292bbd742e369a100c91faa0483172cd91a1a422a6692055ac920946c5/pypiwin32-223-py3-none-any.whl
Collecting pywin32>=223 (from pypiwin32)
  Downloading https://files.pythonhosted.org/packages/8a/37/917c4020e93e0e854d4cbff1cbdf14ec45a6d1cedf52f8cafdea5b22451a/pywin32-224-cp37-cp37m-win32.whl (8.3MB)
     |████████████████████████████████| 8.3MB 142kB/s
Installing collected packages: pywin32, pypiwin32
Successfully installed pypiwin32-223 pywin32-224
thebadguy
  • 2,092
  • 1
  • 22
  • 31
Maruf
  • 11