润杰Y佳创睿review 24-07-24 12:26

python3.12.4版本安装mysqlclient时报错:Collecting mysqlclient
Using cached mysqlclient-2.2.4.tar.gz (90 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpo2cate2i
cwd: /tmp/pip-install-2_arved6/mysqlclient_0f15afa8c82b4bc396eec1711576d565
Complete output (44 lines):
# Options for building extension module:
extra_compile_args: ['-I/usr/include/mysql', '-std=c99']
extra_link_args: ['-L/usr/lib/x86_64-linux-gnu']
define_macros: [('version_info', (2, 2, 4, 'final', 0)), ('__version__', '2.2.4')]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/MySQLdb
copying src/MySQLdb/__init__.py -> build/lib.linux-x86_64-cpython-39/MySQLdb
copying src/MySQLdb/_exceptions.py -> build/lib.linux-x86_64-cpython-39/MySQLdb
copying src/MySQLdb/connections.py -> build/lib.linux-x86_64-cpython-39/MySQLdb
copying src/MySQLdb/converters.py -> build/lib.linux-x86_64-cpython-39/MySQLdb
copying src/MySQLdb/cursors.py -> build/lib.linux-x86_64-cpython-39/MySQLdb
copying src/MySQLdb/release.py -> build/lib.linux-x86_64-cpython-39/MySQLdb
copying src/MySQLdb/times.py -> build/lib.linux-x86_64-cpython-39/MySQLdb
creating build/lib.linux-x86_64-cpython-39/MySQLdb/constants
copying src/MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-39/MySQLdb/constants
copying src/MySQLdb/constants/CR.py -> build/lib.linux-x86_64-cpython-39/MySQLdb/constants
copying src/MySQLdb/constants/ER.py -> build/lib.linux-x86_64-cpython-39/MySQLdb/constants
copying src/MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-39/MySQLdb/constants
copying src/MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-cpython-39/MySQLdb/constants
copying src/MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-cpython-39/MySQLdb/constants
running egg_info
writing src/mysqlclient.egg-info/PKG-INFO
writing dependency_links to src/mysqlclient.egg-info/dependency_links.txt
writing top-level names to src/mysqlclient.egg-info/top_level.txt
reading manifest file 'src/mysqlclient.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'src/mysqlclient.egg-info/SOURCES.txt'
copying src/MySQLdb/_mysql.c -> build/lib.linux-x86_64-cpython-39/MySQLdb
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-cpython-39
creating build/temp.linux-x86_64-cpython-39/src
creating build/temp.linux-x86_64-cpython-39/src/MySQLdb
gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC "-Dversion_info=(2, 2, 4, 'final', 0)" -D__version__=2.2.4 -I/usr/include/python3.9 -c src/MySQLdb/_mysql.c -o build/temp.linux-x86_64-cpython-39/src/MySQLdb/_mysql.o -I/usr/include/mysql -std=c99
src/MySQLdb/_mysql.c:29:10: 致命错误:mysql.h:没有那个文件或目录
29 | #include "mysql.h"
| ^~~~~~~~~
编译中断。
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
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

发布于 北京