python在装 mysqlclient 模块时报错。
host-review%pip install -U mysqlclient
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting mysqlclient
Using cached mysqlclient-1.4.6.tar.gz (85 kB)
ERROR: Command errored out with exit status 1:
command: /home/aireview/python2.7.18/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2JZQZO/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2JZQZO/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-3Hv9l5
cwd: /tmp/pip-install-2JZQZO/mysqlclient/
Complete output (12 lines):
sh: mysql_config: command not found
sh: mariadb_config: command not found
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-2JZQZO/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
EnvironmentError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
centos 解决办法
yum install python-devel mysql-devel
在使用Python的pip工具尝试安装mysqlclient模块时遇到错误,详细错误信息显示mysql_config命令未找到,导致安装过程失败。针对此问题,本文提供了解决方案,即通过在CentOS系统中使用yum命令安装必要的开发包来修复该问题。
1540

被折叠的 条评论
为什么被折叠?



