报错信息:
Collecting mysqlclient==2.1.0Downloading https://mirrors.aliyun.com/pypi/packages/de/79/d02be3cb942afda6c99ca207858847572e38146eb73a7c4bfe3bdf154626/mysqlclient-2.1.0.tar.gz (87 kB)|████████████████████████████████| 87 kB 441 kB/s ERROR: Command errored out with exit status 1:command: /root/.pyenv/versions/3.9.5/envs/hm_bundle_schedule/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-79l21ek7/mysqlclient_1a7c70c578a94ec4b5df3c3a3db9c3d5/setup.py'"'"'; __file__='"'"'/tmp/pip-install-79l21ek7/mysqlclient_1a7c70c578a94ec4b5df3c3a3db9c3d5/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-j8yuji7icwd: /tmp/pip-install-79l21ek7/mysqlclient_1a7c70c578a94ec4b5df3c3a3db9c3d5/Complete output (15 lines):/bin/sh: 1: mysql_config: not found/bin/sh: 1: mariadb_config: not found/bin/sh: 1: mysql_config: not foundTraceback (most recent call last):File "<string>", line 1, in <module>File "/tmp/pip-install-79l21ek7/mysqlclient_1a7c70c578a94ec4b5df3c3a3db9c3d5/setup.py", line 15, in <module>metadata, options = get_config()File "/tmp/pip-install-79l21ek7/mysqlclient_1a7c70c578a94ec4b5df3c3a3db9c3d5/setup_posix.py", line 70, in get_configlibs = mysql_config("libs")File "/tmp/pip-install-79l21ek7/mysqlclient_1a7c70c578a94ec4b5df3c3a3db9c3d5/setup_posix.py", line 31, in mysql_configraise OSError("{} not found".format(_mysql_config_path))OSError: mysql_config not foundmysql_config --versionmariadb_config --versionmysql_config --libs----------------------------------------
WARNING: Discarding https://mirrors.aliyun.com/pypi/packages/de/79/d02be3cb942afda6c99ca207858847572e38146eb73a7c4bfe3bdf154626/mysqlclient-2.1.0.tar.gz#sha256=973235686f1b720536d417bf0a0d39b4ab3d5086b2b6ad5e6752393428c02b12 (from https://mirrors.aliyun.com/pypi/simple/mysqlclient/) (requires-python:>=3.5). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient==2.1.0 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0rc1, 2.1.0, 2.1.1, 2.2.0rc1, 2.2.0)
ERROR: No matching distribution found for mysqlclient==2.1.0
WARNING: You are using pip version 21.1.1; however, version 23.2.1 is available.
You should consider upgrading via the '/root/.pyenv/versions/3.9.5/envs/hm_bundle_schedule/bin/python3.9 -m pip install --upgrade pip' command
原因:系统中没有安装mysql的开发包
解决办法:
mysql_config是MySQL的一个工具,用于检查和配置MySQL的安装路径和编译选项。要解决这个问题,可以尝试以下几个步骤:Ubuntu或Debian:sudo apt-get install libmysqlclient-devCentOS或RHEL:sudo yum install mysql-devel
macOS(使用Homebrew):brew install mysql
Windows(使用MinGW):mingw-get install libmysql
安装完MySQL的开发包后,再次运行您的命令,问题解决