Showing posts with label pip. Show all posts
Showing posts with label pip. Show all posts

How to install pip3 on CentOS and RHEL 6/7 step by step guide


How to install pip3  on CentOS and RHEL 6/7  step by step guide

In this article we will learn how to install pip3 on CentOS and RHEL linux system which is very useful to install python packages for that reason it is called as python package manager.
How to install pip3  on CentOS and RHEL 6/7  step by step guide
How to install pip3  on CentOS and RHEL 6/7  step by step guide

How to install Pip on CentOS and RHEL  linux system

 Pip package is not available the redhat or centos repo. We need to install epel to install the pip package.To install pip on the linux system we need to execute the below commands.

#yum install epel-release
#yum install python-pip

After install this package we need to verify .

How to verify the version of pip

To verify the pip version which you have installed  execute the below commands.

#pip –V 
#pip3 –V

How to run pip to manage python packages

To manage python package ( install ,uninstall and search ) using pip we need to execute the below commands.

#pip install <package_name>
#pip uninstall <package_name>
#pip search <package_name>

That’s all. If this article is helpful please share it!!!!




Please Donate To Bitcoin Address: [[address]]

Donation of [[value]] BTC Received. Thank You.
[[error]]

How to upgrade pip3 on CentOS and RHEL 6/7 step by step guide


How to upgrade pip3  on CentOS and RHEL 6/7  step by step guide

In this article we will learn how to install pip3 on CentOS and RHEL system which is very useful to install python packages for that reason it is called as python package manager.

How to install Pip on CentOS and RHEL  linux system
 

Pip package is not available the redhat or centos repo. We need to install epel to install the pip package.To install pip on the linux system we need to execute the below commands.

#yum install epel-release
#yum install python-pip

After install this package we need to verify the version of pip .

How to verify the version of pip

To verify the pip version which you have installed  execute the below commands.

#pip –V 
#pip3 –V

How to upgrade the version of pip

To upgrade version of pip we need to execute the below command.

# pip3.6 install --upgrade pip

Collecting pip
  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 8.0kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.1.1
How to upgrade pip3  on CentOS and RHEL 6/7  step by step guide
How to upgrade pip3  on CentOS and RHEL 6/7  step by step guide 


How to run pip to manage python packages

To manage python package ( inatall ,uninstall and search ) using pip we need to execute the below commands.

#pip install <package_name>
#pip uninstall <package_name>
#pip search <package_name>

Example:
# pip3.6 install mysql.connector

Collecting mysql.connector
  Downloading https://files.pythonhosted.org/packages/28/04/e40098f3730e75bbe36a338926f566ea803550a34fb50535499f4fc4787a/mysql-connector-2.2.9.tar.gz (11.9MB)

That’s all. If this article is helpful please share it!!!!




Please Donate To Bitcoin Address: [[address]]

Donation of [[value]] BTC Received. Thank You.
[[error]]

How to delete value from table of mysql database using python on CentOS and RHEL 6/7 step by step guide


How to delete value from table of mysql database using python on CentOS and RHEL 6/7  step by step guide


In this article we will learn how to dalete value from table using python language.

We need to install the mysql.connector module using the below command.

#pip3 install mysql.connector

Please follow the below link to insert value into table using python language.

https://techrideradmin.blogspot.com/2019/06/how-to-insert-value-into-table-of-mysql-using-python-on-centos-rhel-step-by-step-guide.html

How to delete value from table using python

First we need to create one file named delete.py and enter the below code into this file  .
import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  passwd="abc123",
  database="pythonclass"
)

cur = mydb.cursor()

query = "DELETE FROM student WHERE location = 'Mumbai'"

cur.execute(query)

mydb.commit()

for affect the row mydb.commit() method is required.

 How to execute the python progam

To execute the python program we need to execute the below command.

[root@localhost ~]# python3 delete.py



After executing the above command record has been deleted from the table.

Now enter the mysql promt and verify it is deleted   or not using “select” statement.


mysql> select * from student;
How to delete value from table of mysql database using python on CentOS and RHEL 6/7  step by step guide
How to delete value from table of mysql database using python on CentOS and RHEL 6/7  step by step guide


That’s all. If this article is helpful please share it!!!!




How to update value into table of mysql database using python on CentOS and RHEL 6/7 step by step guide


How to update value into table of mysql database using python on CentOS and RHEL 6/7  step by step guide


In this article we will learn how to update value into table using python language.

We need to install the mysql.connector module using the below command.

#pip3 install mysql.connector

Please follow the below link to insert value into table using python language.

https://techrideradmin.blogspot.com/2019/06/how-to-insert-value-into-table-of-mysql-using-python-on-centos-rhel-step-by-step-guide.html

How to update value into table using python

First we need to create one file named update.py and enter the below code into this file  .
import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  passwd="abc123",
  database="pythonclass"
)

cur = mydb.cursor()

query = "UPDATE student SET location = 'Mumbai' WHERE location = 'Pune'"

cur.execute(query)

mydb.commit()

for affect the row mydb.commit() method is required.

How to execute the python progam

To execute the python program we need to execute the below command.

[root@localhost ~]# python3 update.py


After executing the above command record has been updated into  the table.

Now enter the mysql promt and verify it is updated  or not using “select” statement.


mysql> select * from student;
How to update value into table of mysql database using python on CentOS and RHEL 6/7  step by step guide
How to update value into table of mysql database using python on CentOS and RHEL 6/7  step by step guide


That’s all. If this article is helpful please share it!!!!




How to fetch value from table of mysql database using python on CentOS and RHEL 6/7 step by step guide


How to fetch value from table of mysql database using python on CentOS and RHEL 6/7  step by step guide


In this article we will learn how to fetch value table using python language.
We need to install the mysql.connector module using the below command.

#pip3 install mysql.connector

Please follow the below link to insert value into table using python language.

https://techrideradmin.blogspot.com/2019/06/how-to-insert-value-into-table-of-mysql-using-python-on-centos-rhel-step-by-step-guide.html

How to fetch value from table using python

First we need to create one file named fetch.py and enter the below code into this file  .

import mysql.connector

 

mydb = mysql.connector.connect(

  host="localhost",

  user="root",

  passwd="abc123",

  database="pythonclass"

)

 

cur = mydb.cursor()

 

cur.execute("select * from student")

result = cur.fetchall()

for x in result:
     print(x)

 How to execute the python progam

To execute the python program we need to execute the below command.
[root@localhost ~]# python3 fetch.py




output:
[root@localhost project]# python3 fetch.py
('Rahul', 'Pune')
How to fetch value from table of mysql database using python on CentOS and RHEL 6/7  step by step guide
How to fetch value from table of mysql database using python on CentOS and RHEL 6/7  step by step guide

After executing the above command record has been fetched from  the table.

Now enter the mysql promt and verify it is created or not using “select” statement.


mysql> select * from student;

mysql> select * from student;
+-------+----------+
| name  | location |
+-------+----------+
| Rahul | Pune     |
+-------+----------+
1 row in set (0.00 sec)


That’s all. If this article is helpful please share it!!!!




Please Donate To Bitcoin Address: [[address]]

Donation of [[value]] BTC Received. Thank You.
[[error]]