Psycopg2 installed successfully but cannot be imported into python

I recently installed psycopg2 on my computer using macport. I followed the instructions on the Psycopg2 website:

sudo port install py27-psycopg2

When i used

port install 

psycopg2 was listed as a successfully installed macport.

However, whenever I print

import psycopg2

in python, it also gives me errors that there are no such modules in python. I am new to computer science. I raised a few questions that resemble mine, but I could understand what was happening. I hope everyone can help me. I really appreciate your help and your time.

+4
source share
2 answers

make

$ sudo port select --list python

All python installations are listed here. eg:

none
python26-apple
python27 (active)
python27-apple
python33
python34

python27, MacPorts:

sudo port select --set python python27

which python

macports python

/opt/local/bin/python
+1

psycopg2 pipeon- 'pip', python mac, :

 pip install psycopg2

python, .

pip , . , :

pip macOS OS X?

0

Source: https://habr.com/ru/post/1607529/


All Articles