Link to home
Start Free TrialLog in
Avatar of Christian de Bellefeuille
Christian de BellefeuilleFlag for Canada

asked on

Exception has occured: ModuleNotFoundError in Python under Visual Studio Code

  • Microsoft Visual Code 1.28.2 x64
  • Python 3.7

I've the smallest code ever
import ldap
print (ldap.__version__)

Open in new window

And i'm getting the error:
  • Exception has occured: ModuleNotFoundError
  • "No module named 'ldap'

I've installed the Wheel found on Christoph Gohlke web site.
using this command: pip install .\python_ldap-3.1.0-cp37-cp37m-win32.whl

I've checked the dependencies as shown here:
User generated image
What am i missing?

Because when i run the following command in terminal, i'm getting "3.1.0" which mean that it can find the ldap module.
python -c "import ldap;print (ldap.__version__)"

Thanks a lot for your help
Avatar of gelonida
Flag of France image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Christian de Bellefeuille


Here's the result:
D:\USERS\Christian\Anaconda3\python.exe sys.version_info(major=3, minor=6, micro=5, releaselevel='final', serial=0)
Apparently it's not using my Python 3.7 but the one that come with Anaconda.  I've followed the instructions "Select a Python Interpreter" from This website, and now it work.

Thanks for pointing me that.

When i type "Python <something>" in terminal window, it's not using that Anaconda, but the one it find in my path (3.7).  That's why it was giving a different result