Search code examples
pythonvisual-studio-codemodulenotfounderrormailmerge

ModuleNotFoundError: No module named 'mailmerge'


The following code brings the above error when executed in VS Code only

from __future__ import print_function
from mailmerge import MailMerge

When I run in in command prompt, however, it performs fine. I have tried uninstalling and reinstalling docx-mailmerge numerous times, as well as updating pip. Any ideas as to why this is only happening in VS Code?


Solution

  • Your VS Code may be configured with the wrong Python environment, or you may have forgotten to activate your virtual environment, if you have one.