一 CentOS(红帽)
yum install mysql-devel
yum install python-devel
pip install mysqlclient
二 Ubuntu
apt-get install libmysql-dev
apt-get install libmysqlclient-dev
apt-get install python-dev
pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
\----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-p8wpb1kf/mysqlclient/
三 Windows
直接下载使用anaconda,创建虚拟环境来进行开发
到这个地址下载自己版本对应的资源
https://www.lfd.uci.edu/~gohlke/pythonlibs/
pip list
Package Version
-------------------- --------
......
mysqlclient 1.4.2
......
有的话就表明安装成功