- Open a terminal window.
- Type the following command and press Enter:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
- This will install the required packages.
- Once the installation is complete, you can start using Python to connect to MySQL.
Here are some additional information about the packages that you are installing:
python3-dev
: This package contains the development headers and libraries for Python 3.default-libmysqlclient-dev
: This package contains the development headers and libraries for the MySQL client library.build-essential
: This package contains a collection of essential development tools.
Now after we have installed all these, without any errors we can successfully install mysqlclient.
Open a terminal window.
Type the following command and press Enter:
pip install mysqlclient
This will successfully install the mysqlclient package.
Here are some additional information about the mysqlclient package:
The mysqlclient package is a Python library that provides a MySQL database adapter.
The mysqlclient package is available for Python 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, and 3.9.
The mysqlclient package can be installed using pip.