当前位置: 首页 > news >正文

pip安装mysqlclient依赖报错 /bin/sh: 1: mysql_config: not found如何解决

报错信息:

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的开发包后,再次运行您的命令,问题解决

http://www.lryc.cn/news/145050.html

相关文章:

  • 基于paddleocr的版面分析
  • 网工内推 | IT网工,华为、华三认证优先,15k*13薪
  • leetcode 739. 每日温度
  • 【活体检测模型】活体检测思路推演
  • 【微服务部署】03-健康检查
  • SQL注入之报错注入
  • 基于大数据+django+mysql的银行信用卡用户的数仓系统
  • 【网络】多路转接——五种IO模型 | select
  • sql顺序倒序查询
  • java和sql生成时间维度数据
  • HUT23级训练赛
  • sm4 加解密算法工具类( Java 版 )
  • Redis项目实战——商户查询缓存
  • 重磅OpenAI发布ChatGPT企业版本
  • # Go学习-Day7
  • uniapp-form表单
  • 漏洞挖掘-利用
  • React钩子函数之useDeferredValue的基本使用
  • lodash常用方法
  • QByteArray与结构体之间相互转换
  • npm如何安装淘宝镜像
  • 从项目中突显技能:在面试中讲述你的编程故事
  • python的观察者模式案例
  • C语言——类型转换
  • jmeter性能测试入门完整版
  • 报错sql_mode=only_full_group_by
  • 伪造 IP 地址的原理和防范措施
  • Linux通过libudev获取挂载路径、监控U盘热拔插事件、U盘文件系统类型
  • 【会议征稿】2023智能通信与网络国际学术会议(ICN 2023)
  • Android投屏总结