ModuleNotFoundError: No module named 'pg'

3.6k Views Asked by At

After trying to use pg library in Python as just as

import pg

I get this error message:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'pg'

how to import correctly the library?

1

There are 1 best solutions below

1
On BEST ANSWER

The pg library has not the same name as the importing name so not very intuitive. According to the official documentation http://www.pygresql.org/contents/install.html in order to install it all you have to do is running

pip install PyGreSQL