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:Users212703751>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:Users212703751>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:Users212703751>conn_test.py
Traceback (most recent call last):
File "C:Users212703751AppDataLocalProgramsPythonPython37conn_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
question from:
https://stackoverflow.com/questions/66054761/modulenotfounderror-no-module-named-psycopg2-when-running 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…