1

I'm getting the error that [there is] no module n named psycopg2 that is found. This is the output of my IDLE, Python Editor.

output of IDLE

I'm running VirtualBox, Vagrant on Terminal on my Mac.

terminal info

So why does my IDLE output there is no module? I am using psycopg2 to connect to my database as per my assignment instructions. The goal of the program that I'm trying to build is to output certain data by just running .py file in Terminal (output like rows and columns gets displayed after running)...

  • 1
    You have success installation for python3.x, but your installation for python2.x is failed. So which version of pythons you are running? – hcheung Dec 11 '18 at 03:01
  • Thank you, I’m running python3 but have both when I use python [file] in terminal – purpleorbiter63 Dec 11 '18 at 03:04
  • My version of idle is up to date so I am not sure why I get my error of “no module for psycopg2”. I import it at the beginning of my .py file and use it correctly to connect to the database – purpleorbiter63 Dec 11 '18 at 03:06
  • 1) try python3 yourscript.py; 2) check your path setting; – hcheung Dec 11 '18 at 03:07
  • How do I check my python path setting? I tried both python3 and python and output different results (but print) but how about IDLE and running the module? Why is the output no module psycog2 found? – purpleorbiter63 Dec 11 '18 at 03:21
  • https://stackoverflow.com/a/18247492/4902099 – hcheung Dec 11 '18 at 05:47
  • Exceptions appearing in IDLE's Shell are generated by the python binary that is running IDLE. ModuleNotFoundError means that the module was not found *by python* in any directory on that executing binary's sys.path. Run 'import sys; print(sys.executable, sys.path)' to see both the python executable and its path. – Terry Jan Reedy Dec 11 '18 at 19:32

0 Answers0