When I'm trying to run a .py file from the command prompt on Windows 10, I get the error: ModuleNotFoundError: No module named 'psycopg2'. However, it was installed successfully and works from the interpreter. The conn_test.py file contains only the import psycopg2 statement.
C:\Users\212703751>python -m pip install psycopg2-binary
Collecting psycopg2-binary
Using cached psycopg2_binary-2.8.6-cp37-cp37m-win_amd64.whl (1.1 MB)
Installing collected packages: psycopg2-binary
Successfully installed psycopg2-binary-2.8.6
C:\Users\212703751>python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> exit()
C:\Users\212703751>conn_test.py
Traceback (most recent call last):
File "C:\Users\212703751\AppData\Local\Programs\Python\Python37\conn_test.py", line 1, in <module>
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
I've tried many approaches, none of them worked.
Do you have any idea, how can I solve this? I'm using Windows 10 x64, and Python 3.7.2