首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法安装MySQLdb模块Centos 7 Python 3

无法安装MySQLdb模块Centos 7 Python 3
EN

Stack Overflow用户
提问于 2021-11-25 23:38:57
回答 1查看 117关注 0票数 0

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

代码语言:javascript
复制
    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

EN

回答 1

Stack Overflow用户

发布于 2021-11-26 16:28:59

您可能会丢失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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70118307

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档