Kashipara.com is a community of 5.00 lakh programmers and students, just like you, helping each other. Join them; it only takes a minute: Sign Up

Python installation and database configuration step by step

1. Download latest python 3.7 & xampp for mysql databases

Download latest version of python i.e 3.7. After successful download install it. https://www.python.org/downloads/ Download python 3.7

Here you can download latest version of xampp, and then install it. https://www.apachefriends.org/download.html Download xampp

2. Install python 3.7

After successfully download python, then Click on setup files and then install it.

Instalation steps

3. Check python & pip version by commands

Use this command to check python version.

cmd > python

User this command to check pip versions.

cmd > pip --version

4. Pip not install then use this command for install.

Installing with get-pip.py. To install pip, securely download get-pip.py.
run this command -

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Then run the following:
python get-pip.py

5. Install PyMySQL library.

For Installing PyMySQL library.
run this command -

pip3 install PyMySQL

6. Create a file db.py Database connection code.

create a db.py file with below code.

    import pymysql

    conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='root', db='user')

    cur = conn.cursor()
    cur.execute("SELECT * FROM user_email")


    for row in cur:


Create a database & table and insert dummy records.

You have to know basic about phpmyadmin and mysql. Firstly you have to learn how to create a database and table then run this code. open phpmyadmin for a database and tabel - localhost/phpmyadmin.
Databasename - user.
Tabelname - user_email

7. Finally run Database connection code.

Run python database connection code.that code put in c:/apy/db.py
run this command -

python db.py