I have read pip install mysql-python fails with EnvironmentError: mysql_config not found and mysql_config not found when installing mysqldb python interface and I am sure it is not a duplicate question.
I had run sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config
and I have those build tools. I have mariadb installed. I also tried a different pypi mirror and the issue presists.
Now I tried pip install mysqlclient
and I got this. It seemed that pip is trying through versions. Finally I installed version 2.1.1
Collecting mysqlclient
Using cached https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/7d/62/51fbcd851834c830c940ded80280f593bd031137603329dd89479c68c5be/mysqlclient-2.2.6.tar.gz (91 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
WARNING: Generating metadata for package mysqlclient produced metadata for project name unknown. Fix your #egg=mysqlclient fragments.
Discarding https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/7d/62/51fbcd851834c830c940ded80280f593bd031137603329dd89479c68c5be/mysqlclient-2.2.6.tar.gz#sha256=c0b46d9b78b461dbb62482089ca8040fa916595b1b30f831ebbd1b0a82b43d53 (from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/mysqlclient/) (requires-python:>=3.8): Requested unknown from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/7d/62/51fbcd851834c830c940ded80280f593bd031137603329dd89479c68c5be/mysqlclient-2.2.6.tar.gz#sha256=c0b46d9b78b461dbb62482089ca8040fa916595b1b30f831ebbd1b0a82b43d53 has inconsistent name: filename has 'mysqlclient', but metadata has 'unknown'
Using cached https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/be/95/1af2ee813d4f0b607082c18bb82aa05c98a95a402a1d2d5808999317cb16/mysqlclient-2.2.5.tar.gz (90 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
WARNING: Generating metadata for package mysqlclient produced metadata for project name unknown. Fix your #egg=mysqlclient fragments.
Discarding https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/be/95/1af2ee813d4f0b607082c18bb82aa05c98a95a402a1d2d5808999317cb16/mysqlclient-2.2.5.tar.gz#sha256=add8643c32f738014d252d2bdebb478623b04802e8396d5903905db36474d3ff (from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/mysqlclient/) (requires-python:>=3.8): Requested unknown from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/be/95/1af2ee813d4f0b607082c18bb82aa05c98a95a402a1d2d5808999317cb16/mysqlclient-2.2.5.tar.gz#sha256=add8643c32f738014d252d2bdebb478623b04802e8396d5903905db36474d3ff has inconsistent name: filename has 'mysqlclient', but metadata has 'unknown'
Using cached https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/79/33/996dc0ba3f03e2399adc91a7de1f61cb14b57ebdb4cc6eca8a78723043cb/mysqlclient-2.2.4.tar.gz (90 kB)
Installing build dependencies ... -^canceled
ERROR: Operation cancelled by user
My system is Linux VM-16-16-ubuntu 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
My python version is Python 3.10.12
Thanks to @bodo,Now I know that though I can install the package onto windows, but my ubuntu may not support the latest version. I never knew that before