官网的Github 首页有关于如何下载的说明:https://github.com/PyMySQL/mysqlclient-python
Prerequisites
You may need to install the Python and MySQL development headers and libraries like so:
sudo apt-get install python-dev default-libmysqlclient-dev # Debian / Ubuntu
sudo yum install python-devel mysql-devel # Red Hat / CentOS
brew install mysql-connector-c # macOS (Homebrew) (Currently, it has bug. See below)
On Windows, there are binary wheels you can install without MySQLConnector/C or MSVC.
Note on Python 3 : if you are using python3 then you need to install python3-dev using the following command :
sudo apt-get install python3-dev # debian / Ubuntu
sudo yum install python3-devel # Red Hat / CentOS
也就是说,我们需要在linux 中先将依赖条件python-devel mysql-devel或者python3-devel mysql-devel下载好,然后再下载
Install from PyPI
pip install mysqlclient
NOTE: Wheels for Windows may be not released with source package. You should pin version in your requirements.txt to avoid trying to install newest source package.
Install from source
Download source by git clone or zipfile.
Customize site.cfg
python setup.py install
也就是说再安装python3环境的时候就顺便把他下载好了
wget sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git python36 python36-devel mysql-devel
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
tar -zxvf Python-3.6.8.tgz