Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named pywin32

I tried both

pip install pypiwin32

and

pip install pywin32

and they both succeeded on my Windows 7 x64 / Python 2.7.15 64-bit (it's the only Python I have installed on my PC). I even did:

python C:\Python27\Scripts\pywin32_postinstall.py -install

and it successfully returned:

...
Shortcut to documentation created
The pywin32 extensions were successfully installed.

Still I get, when doing import pywin32:

ImportError: No module named pywin32

How to install pywin32 on Windows 7?

like image 710
Basj Avatar asked Jun 04 '18 14:06

Basj


2 Answers

The solution is indeed

import win32api

instead of import pywin32!

like image 139
Basj Avatar answered Nov 01 '22 06:11

Basj


I'm just putting this here in case someone is interested. This is an exerpt from the book Python Programming On Win32: Help for Windows Programmers written by M. Hammond and A. Robinson listing modules in the Pywin32 package (or the win32all package as it was called before):

mmapfile - Interfaces to Windows memory-mapped files, a mechanism that allows data to be shared among multiple processes.

odbc - An interface to the Open DataBase Connectivity API, a portable API for connection to multiple database.

win32api - Accesses many of the common and simple Windows APIs; a general-purpose module with a cross section of API support.

win32event - Accesses the Windows even the signaling API. This module allows you to manipulate and wait for Windows events, semaphores, mutexes, etc.

win32evtlog, win32evtlogutil - An interface to the Windows NT Event Log. The win32evtlog module provides a raw interface to the Windows NT API, while the win32evtlogutil module provides utilities to simplify working with the module.

win32pdh - An interface to the Windows NT Performance Monitor. This module uses a helper DLL provided by Microsoft known as the Performance Data Helper or PDH.

win32pipe - Accesses the pipe-related Win32 functions, such as functions for creating and using pipes, named pipes.

win32file - Accesses the file-related Win32 functions. This module exposes a low-level, raw interface to files on Windows and is used only when the standard Python file object isn't suitable.

win32lz - An interface to the Windows LZ compression library. Note that since this module was created, Python now ships with support for the gzip compression format, so in most cases win32lz is no longer used.

win32net, win32wnet - Interface to the Windows networking API. win32net provides an interface to Windows NT-specific server networking, while win32wnet provides client-networking functions available to all versions.

win32print - Interface to the printer-related Windows APIs.

win32process - Interface to the process-related Windows APIs.

win32ras - Interface to the Windows Remote Access Service (RAS). Used for establishing remote connections to Windows NT servers, typically using a modem.

win32security - Accesses the Windows NT security-related functions.

win32service, win32serviceutil - Access the Windows NT Services-related API.

win32trace, win32traceutil - Debugging related modules. These modules allow you to collect the output of a Python process in a separate process. This is most useful when debugging server-style application, where Python error and other messages are not available.

Note: The content may be a bit out of date as the book was published in 2000.

like image 3
Vaclav Pelc Avatar answered Nov 01 '22 06:11

Vaclav Pelc