简体   繁体   中英

Error "No module named pywin32" after downloading it in anaconda

I'm trying to create a module that uploads multiple files to an email using python. The method I've elected to use is found here ( https://www.codeforests.com/2020/06/05/how-to-send-email-from-outlook/ ) which requires that you install pywin32. I tried to do the pip install, which didn't work as it was already downloaded, but I'm still having trouble getting the module to run properly. I've tried uninstalling and reinstalling, and I have it in Anaconda on both my base & spyder environments, but every time I run it (either JNB or Spdr) I get the same ModuleNotFoundError.

Thanks in advance.

[Python.Docs]: Built-in Exceptions - exception ModuleNotFoundError (text: No module named 'X' ) occurs when an import is attempted on a non existing module ( X ). In your case it's (most likely):

import pywin32

PyWin32 doesn't work that way, as it's a collection of modules (packages), and thus it can't be imported directly. You must import specific module(s) for your task, like:

import win32api
import win32com.client as wcomcl

Check:

So it turns out everything worked out whenever I downgraded the version of python I was using...

pip install pywin32==225

Thanks for your help, everyone!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM