I've already installed the dependencies with sudo apt-get build-dep python-psycopg2 and then installing psycopg2 with sudo pip install psycopg2 and even with easy_install psycopg2. But even after all this, if I run python3 code.py I get
ImportError: No module named 'psycopg2'
If I run sudo apt-get build-dep python3-psycopg2 I get
Picking 'psycopg2' as source package instead of 'python3-psycopg2'
0 upgraded, 0 newly installed, 0 to remove and 144 not upgraded.
Same with sudo apt-get build-dep python-psycopg2
Please help.
its always better to work in virtualenv and not mess up with your system
try:
virtualenv -p /usr/bin/python3 test_env
source test_env/bin/activate
pip install psycopg2
run python and try to import
if you insist on installing it on your systems python try:
pip3 install psycopg2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With