Skip to content Skip to sidebar Skip to footer

Importerror: No System Module 'pywintypes' (pywintypes39.dll)

I was making a virtual assistant in python, but I see the following error. ImportError: No system module 'pywintypes' (pywintypes39.dll) I am using Windows 10 and Python 3.9 Here

Solution 1:

On Command prompt type python -m site to get the site-package. Now navigate to the site-package folder and go to pywin32_system32 to copy pythoncom39.dll and pywintypes39.dll

Navigate one step back to site-package folder and got win32 and paste the file.

Solution 2:

You've commented that you dumped the project you were working on. But I thought I answer anyway for those who still get this error or are going to.

I had the same issue but there was no solution to the problem that I could find online. So I decided to read the error message and to understand what it says

Notice that File <path> the errors are referring to.

The <path> is C:\Users\visha\AppData\Roaming\Python\Python39\site-packages\....

In this folder, there is a directory called pywin32_system32.

That's the directory you're looking for. The problem was that pypiwin32 was installed but not in the Python PATH that it should have!

For example:

My Python location is C:\Program Files\Python39

My Python path in System Environment Variables is set to C:\Program Files\Python39

When I ran the command pip install pypiwin32, it was installed on C:\Users\<user>\AppData\Roaming\Python\Python39\site-packages which is not the right directory.

Inside the directory, pywin32_system32, is the file you are looking for (pywintypes39.dll).

**All you have to do is to copy the pywin32_system32 folder from C:\Users\visha\AppData\Roaming\Python\Python39\site-packages\

to

<Python_PATH>\site-packages\**

(C:\Program Files\Python39\sitepackages\ for example.)

Sorry if the answer came a little too late! I hope what I wrote is not confusing because I tried my best to explain it in simple words.

Solution 3:

try uninstall pywin32 and install it again, works for me

Solution 4:

pywintypes is a part of Python for Windows extensions, or its know as pywin32 you will need to install it. and i am not sure it will work but you can try this pip install pypiwin32.

Solution 5:

Even thou the question is already answered, I had that issue now and used the answer from DecodedIntel, but even thou it works, you can see another issue in the future after using pip install NewModule and there's a way to fix it once and for all.

My Python location is C:\Program Files\Python39

My PIP Modules location is C:\Users<user>\AppData\Roaming\Python\Python39\site-packages

To fix it you can use Windows HARD LINK Directory JUNCTION

Use /J to create a hard link pointing to a directory, also known as a directory junction:

mklink /J Link Target

MSDOS MKLINK Cmd help description

So, for example, if you wanted to create a directory junction (a hard link to a folder) at C:\LinkToFolder that pointed to C:\Users\Name\OriginalFolder, you’d run the following command:

mklink /J C:\LinkToFolder C:\Users\Name\OriginalFolder

You’ll need to put quotation marks around paths with spaces. For example, if the folders are instead named C:\Link To Folder and C:\Users\Name\Original Folder, you’d use the following command instead:

mklink /J "C:\Link To Folder" "C:\Users\Name\Original Folder"

If you see the message “You do not have sufficient privilege to perform this operation.”, you need to launch the Command Prompt as Administrator before running the command.

C:\Users\MyUserName\AppData\Roaming\Python>mklink /j Python39 "C:\Program Files\Python39" Junction created for Python39 <<===>> C:\Program Files\Python39

Post a Comment for "Importerror: No System Module 'pywintypes' (pywintypes39.dll)"