Python Forum
PostgreSQL- import package - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: PostgreSQL- import package (/thread-3615.html)



PostgreSQL- import package - elhetch - Jun-07-2017

i am trying to use postgreSQL package , i had tried the following:
python -m pip install -U pip setuptools
python get-pip.py
pip install 'psycopg2'
import postgresq2
import postgresql
all what i get is invalid syntax
i been trying different combination for almost 2 hrs without knowing what to do , it is really frustrating.


RE: PostgreSQL- import package - j.crater - Jun-07-2017

You need to run first 3 commands you wrote in a system console (e.g.: command prompt on Windows, Terminal on Linux), and the other 2 in a Python console. 'import' lines are Python code that get executed, other 3 lines are scripts your system executes.
Considering the returned error, I guess you attempted to execute all of them in Python console.


RE: PostgreSQL- import package - snippsat - Jun-07-2017

It's pip install psycopg2
Windows Python 3.6.1 pip 9.0.1,will find wheel automatic.
(post_gres) E:\1py_div\database\post_gres
λ pip install psycopg2
Collecting psycopg2
 Using cached psycopg2-2.7.1-cp36-cp36m-win32.whl
Installing collected packages: psycopg2
Successfully installed psycopg2-2.7.1
Same for Linux,Python 3.6.1 pip 9.0.1.
(data_env) mint@mint ~/.pyenv/versions/data_env $ pip3 install psycopg2
Collecting psycopg2  
 Downloading psycopg2-2.7.1-cp36-cp36m-manylinux1_x86_64.whl (2.7MB)
   100% |████████████████████████████████| 2.7MB 382kB/s 
Installing collected packages: psycopg2
Successfully installed psycopg2-2.7.1