Avatar of Christian de Bellefeuille
Christian de Bellefeuille
Flag for Canada asked on

Exception has occured: ModuleNotFoundError in Python under Visual Studio Code

Using:
  • 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:
Capture.PNG
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
ProgrammingMicrosoft DevelopmentActive DirectoryPython

Avatar of undefined
Last Comment
Christian de Bellefeuille

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
gelonida

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Christian de Bellefeuille

ASKER
Here's the result:
D:\USERS\Christian\Anaconda3\python.exe sys.version_info(major=3, minor=6, micro=5, releaselevel='final', serial=0)
Christian de Bellefeuille

ASKER
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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck