Hello everyone. I am going to use postgreSQL in Python 3.5.1 but I cannot import psycopg2 module. Can you help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hello everyone. I am going to use postgreSQL in Python 3.5.1 but I cannot import psycopg2 module. Can you help me?

Using database

26th Feb 2017, 7:12 PM
Firuz Juraev
Firuz Juraev - avatar
4 Answers
+ 1
Did you install psycopg2? If so was the install successful? Did you install it to your main python install or a virtual environment? Windows PC? Mac? What error are you getting? Are you using an IDE? If so which one? Did you install PostgreSQL? Your question is far to vague to actually get any real help.
26th Feb 2017, 8:07 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
I download psycopg2 exe file but I cannot connect it to my pc in cmd
26th Feb 2017, 8:10 PM
Firuz Juraev
Firuz Juraev - avatar
+ 1
How can I install psycopg2? Just clicking or do smth in cmd
26th Feb 2017, 8:11 PM
Firuz Juraev
Firuz Juraev - avatar
0
For Windows PC: Note this is assuming you have Python installed and the Path variable for its location is set in your environment variables as well. Install PostgreSQL if not already installed. https://www.postgresql.org Upon completing install we need to add the install location to the PATH environment variable. Locate your install location in your Program Files and copy the path of its bin folder. It should be something like: C:\Program Files\PostgresSQL\9.6\bin System > Control Panel > Advanced System Settings > (Advanced Tab) click Environment Variables button Under User Variables for ... Select PATH and then click the Edit button. If your PostgresSQL bin path is not listed click new and add it. Repeat above for System variables. Install git for windows. https://git-for-windows.github.io During install when you reach the "Adjusting your PATH environment" select "use git from bash only" Leave all other options as they are. For "Configuring the terminal emulator to use with Git Bash" ensure that "Use MinTTY" is selected. At last window you can unselect the "View release notes" From Start menu search "Git Bash" then right click and run as administrator. Leave Git Bash window open for now. Download psycopg for windows for your version of python. http://www.stickpeople.com/projects/python/win-psycopg/ Go to Git Bash and change directories to where you downloaded the installer. cd ~/Downloads You can enter ls to check that you are in the correct folder. This will list the contents of the directory, and you should see the psycopg install file listed. Now type, python -m easy_install psycopg2-2.6.2.win32-py3.6-pg9.6.1-release.exe (or whichever file you downloaded) If the install fails you most likely need to install and set your Python Path variable.
26th Feb 2017, 9:00 PM
ChaoticDawg
ChaoticDawg - avatar