When I install psycopg2, it's always installing into Python 2.7, but I use Python 3.7. And cannot import psycopg2 into my module. Is there a way to redirect installation? From terminal Python successfully importing psycopg2, and Python3 raise error.
Asked
Active
Viewed 30 times
0
-
1How are you installing it? Probably use `pip3n instead of `pip`. – tripleee Sep 06 '20 at 12:12
-
1Have you created virtual environments? If so, switch to the 3.7 one before installing the package. If not, make it a habit. :-) – navneethc Sep 06 '20 at 12:16
-
1`python3 -m pip install --user psycopg2-binary` – Jared Smith Sep 06 '20 at 12:16
-
https://stackoverflow.com/search?q=%5Bpip%5D+different+python+version – phd Sep 06 '20 at 13:37
-
sudo apt-get install python3-psycopg2 This command do it. Only Python 3.7 give error, but Python 3.6 works fine. – Vitaly Perevoshchikov Sep 06 '20 at 17:00