1 Python 3.7.4 下,安装 mysqlclient 2.0.2 版本报错
/usr/local/python3/bin/pip3 install mysqlclient==2.0.2
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting mysqlclient==2.0.2
Using cached http://mirrors.aliyun.com/pypi/packages/0e/68/f79de0e0fcdb041783124b825771e0ba6a3d0893b7b4c4735f130e42af47/mysqlclient-2.0.2.tar.gz (88 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for mysqlclient (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-37
creating build/lib.linux-x86_64-cpython-37/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-cpython-37/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-cpython-37/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-cpython-37/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-cpython-37/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-cpython-37/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-cpython-37/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-cpython-37/MySQLdb
MySQLdb/_mysql.c:1340:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (unsigned int i=0; i<n; i++) {
^
MySQLdb/_mysql.c:1340:5: note: use option -std=c99 or -std=gnu99 to compile your code
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
Failed to build mysqlclient
ERROR: Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects
2 python 3.7.4 与mysqlclient 2.0.2 不兼容,安装高版本
/usr/local/python3/bin/pip3 install mysqlclient==2.1.1
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting mysqlclient==2.1.1
Downloading http://mirrors.aliyun.com/pypi/packages/50/5f/eac919b88b9df39bbe4a855f136d58f80d191cfea34a3dcf96bf5d8ace0a/mysqlclient-2.1.1.tar.gz (88 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.1/88.1 kB 1.9 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (pyproject.toml) ... done
Created wheel for mysqlclient: filename=mysqlclient-2.1.1-cp37-cp37m-linux_x86_64.whl size=99123 sha256=a2185f340899c8241c61255a9fb172318ca0c8d821c941797ff5d18d3f4a875c
Stored in directory: /root/.cache/pip/wheels/b8/f9/7d/9c1d88ddeaad8b2002980d45158b426b5943a1391249e42ec5
Successfully built mysqlclient
#查看安装包
/usr/local/python3/bin/pip3 list| grep mysqlclient
mysqlclient 2.1.1
3 windows 下面 ,下载之后安装
方便下载,特提供网盘
链接:https://pan.baidu.com/s/1gDy6rDpYDfEKqFB8H4sVvQ
提取码:mu38
pip isntall mysqlclient-2.0.2-cp37-cp37m-win_amd64.whl