0

I am using Visual Code and wanted to script some Python code that connects to a database. Psycopg2 seems to be the perfect library for just that. So I had in my settings.json file:

{
    "python.linting.pylintEnabled": true,
    "python.autoComplete.extraPaths": [
    "c:/OSGeo4W64/apps/python27",
    "C:/OSGeo4W64/apps/Python27/Lib/site-packages/psycopg2"
    ],
    "python.pythonPath": "C:/OSGeo4W64/bin/python.exe"

}

I still get the error

'no module named psycopg2'

on the first line in my code: import psycopg2.

demongolem
  • 9,474
  • 36
  • 90
  • 105
Pim Verver
  • 21
  • 1
  • 4

1 Answers1

0

Or psycopg2 is install but not in the right place you can check where it is with this method :

How do I find the location of Python module sources?

or as have said bernie you don't have psycopg2you can check this way:

https://askubuntu.com/questions/588390/how-do-i-check-whether-a-module-is-installed-or-not-in-python

in this case in your terminal do : pip install psycopg2or if you use anaconda conda install -c anaconda psycopg2=2.7.1

Community
  • 1
  • 1
Dadep
  • 2,796
  • 5
  • 27
  • 40