我有一个python代码,它使用了mysqldb模块,我搜索了很多次,看起来这个模块不再适用于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/发布于 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
https://stackoverflow.com/questions/70118307
复制相似问题