When MySQL DB is introduced into Python scripts, errors are often reported. It’s not easy to install on MAC, windows and CentOS before. Here’s a summary. First, follow these basic dependencies:
sudo yum install mysql-devel gcc python-devel
// Install the Python development version and its headers
yum install python-devel.x86_64 (for python2)
sudo yum install python3-devel (for python3)
Then try
yum install MySQL-python -y
If it still fails, continue to install MSYQL
sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm#install mysql镜像
sudo yum install mysql mysql-server mysql-libs mysql-server#install mysql
Then install MySQL python
yum install MySQL-python -y
In addition, if it is Python 3, you may need to install the following:
pip3 install mysqlclient==1.3.7
pip3 install PyMySQL
Similar Posts:
- How to Solve Django Error: No module named ‘MySQLdb’
- CenterOS7: How to Solve error: No package mysql-server available.
- Solve yum install mysql-server exception under CentOS7: No package mysql-server available.
- [Solved] Python import module error: importerror: no module named mysql.connector
- Linux Error: _mysql.c:32:20: fatal error: Python.h: No such file or directory [Solved]
- Failed to install MySQL server in centos7 (no package available)
- MySQL_python‑1.2.5‑cp27‑none‑win_amd64.whl is not a valid wheel filename.
- Error in Python compilation on MAC no module named mysqldb
- Linux environment installation MYSQL Error: Redirecting to /bin/systemctl start mysqld.service Failed to start mysqld.service: Unit not found.
- CentOS 7: How to Solve Mysqlclient Install Error