我已阅读pip install mysql-python因环境错误而失败:未找到mysql_config和安装mysqldb python接口时未找到mysql_config,我确信这不是重复的问题。
我已经运行了
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config
并且我有那些构建工具。我已经安装了 mariadb。我还尝试了不同的 pypi 镜像,问题仍然存在。
现在我尝试了
pip install mysqlclient
,我得到了这个。看来 pip 正在尝试版本。最后我安装了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
我的系统是 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
我的Python版本是Python 3.10.12
感谢@bodo,现在我知道虽然我可以将软件包安装到Windows上,但我的ubuntu可能不支持最新版本。我以前从来不知道