【问题标题】:Cant install MySQLdb module Centos 7 Python 3无法安装 MySQLdb 模块 Centos 7 Python 3
【发布时间】:2022-01-04 03:42:54
【问题描述】:

我有一个使用模块 mysqldb 的 python 代码,我搜索了很多,看起来该模块不再适用于 python3,我尝试了很多解决方案直到我达到这一点,每当我使用 pip3 install mysqlclient 时,我都会得到这个错误:

    Collecting mysqlclient
  Using cached mysqlclient-2.1.0.tar.gz (87 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dhu9r_pj/mysqlclient_0e2dcd019f494a5a9aba92fe372a86ec/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dhu9r_pj/mysqlclient_0e2dcd019f494a5a9aba92fe372a86ec/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'"'"'))' bdist_wheel -d /tmp/pip-wheel-613c27qp
       cwd: /tmp/pip-install-dhu9r_pj/mysqlclient_0e2dcd019f494a5a9aba92fe372a86ec/

https://pastebin.com/WKXBkFWB

【问题讨论】:

  • 请将您的输出作为文本发布。 Stack Overflow 不接受文本截图。
  • pastebin 不是图像它是一个文本站点
  • pastepin 链接已添加

标签: python mysql module mysql-python


【解决方案1】:

您可能缺少mysql-devel python3-devel

在从源代码构建时需要它们。 2.1.0 的预构建包可用于 CPython 3.7-3.10

对于 CPython 3.6,您可以尝试 pip install mysqlclient==2.0,对于 3.5,您可以尝试 pip install mysqlclient==1.3.12

【讨论】:

  • 我确保我安装了两个包,python3-devel-3.6.8 和 MariaDB-devel-10.4.22 python 版本是 3.6.8,我尝试了 mysqlclient 2.0 和 1.3.12,同样的错误。谢谢!!
猜你喜欢
  • 2017-07-30
  • 1970-01-01
  • 2017-09-13
  • 2012-12-16
  • 2018-10-23
  • 1970-01-01
  • 2013-11-23
  • 2017-05-27
  • 2020-08-04
相关资源
最近更新 更多