python3 安装mysqlclient 报错+亲测有用

2024-06-22 18:52

本文主要是介绍python3 安装mysqlclient 报错+亲测有用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

报错信息

[root@iZbp1ihrdhzp9kwn7g94jiZ myproject]# pip3.11 install mysqlclient==2.1.1
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting mysqlclient==2.1.1Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/50/5f/eac919b88b9df39bbe4a855f136d58f80d191cfea34a3dcf96bf5d8ace0a/mysqlclient-2.1.1.tar.gz (88 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.1/88.1 kB 12.3 MB/s eta 0:00:00Installing build dependencies ... doneGetting requirements to build wheel ... donePreparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mysqlclientBuilding wheel for mysqlclient (pyproject.toml) ... errorerror: subprocess-exited-with-error× Building wheel for mysqlclient (pyproject.toml) did not run successfully.│ exit code: 1╰─> [59 lines of output]/tmp/pip-build-env-bsxoy4ow/overlay/lib/python3.11/site-packages/setuptools/dist.py:478: SetuptoolsDeprecationWarning: Invalid dash-separated options!!********************************************************************************Usage of dash-separated 'index-url' will not be supported in futureversions. Please use the underscore name 'index_url' instead.By 2024-Sep-26, you need to update your project and remove deprecated callsor your builds will no longer be supported.See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.********************************************************************************!!opt = self.warn_dash_deprecation(opt, section)mysql_config --version['5.7.29']mysql_config --libs['-L/usr/lib64/mysql', '-lmysqlclient', '-lpthread', '-lm', '-lrt', '-ldl']mysql_config --cflags['-I/usr/include/mysql', '-m64']ext_options:library_dirs: ['/usr/lib64/mysql']libraries: ['mysqlclient', 'pthread', 'm', 'rt', 'dl']extra_compile_args: ['-std=c99', '-m64']extra_link_args: []include_dirs: ['/usr/include/mysql']extra_objects: []define_macros: [('version_info', "(2,1,1,'final',0)"), ('__version__', '2.1.1')]running bdist_wheelrunning buildrunning build_pycreating buildcreating build/lib.linux-x86_64-cpython-311creating build/lib.linux-x86_64-cpython-311/MySQLdbcopying MySQLdb/__init__.py -> build/lib.linux-x86_64-cpython-311/MySQLdbcopying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-cpython-311/MySQLdbcopying MySQLdb/connections.py -> build/lib.linux-x86_64-cpython-311/MySQLdbcopying MySQLdb/converters.py -> build/lib.linux-x86_64-cpython-311/MySQLdbcopying MySQLdb/cursors.py -> build/lib.linux-x86_64-cpython-311/MySQLdbcopying MySQLdb/release.py -> build/lib.linux-x86_64-cpython-311/MySQLdbcopying MySQLdb/times.py -> build/lib.linux-x86_64-cpython-311/MySQLdbcreating build/lib.linux-x86_64-cpython-311/MySQLdb/constantscopying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-cpython-311/MySQLdb/constantscopying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-311/MySQLdb/constantscopying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-cpython-311/MySQLdb/constantscopying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-cpython-311/MySQLdb/constantscopying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-311/MySQLdb/constantscopying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-cpython-311/MySQLdb/constantsrunning build_extbuilding 'MySQLdb._mysql' extensioncreating build/temp.linux-x86_64-cpython-311creating build/temp.linux-x86_64-cpython-311/MySQLdbgcc -pthread -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/usr/include/mysql -I/opt/django-cms/.venv/include -I/usr/include/python3.11 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-cpython-311/MySQLdb/_mysql.o -std=c99 -m64MySQLdb/_mysql.c:46:10: fatal error: Python.h: No such file or directory46 | #include "Python.h"|          ^~~~~~~~~~compilation terminated.error: command '/usr/bin/gcc' failed with exit code 1[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.ERROR: Failed building wheel for mysqlclient
Failed to build mysqlclient
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mysqlclient)

环境信息

[root@iZbp1ihrdhzp9kwn7g94jiZ myproject]# uname -r
5.10.134-16.1.al8.x86_64
[root@iZbp1ihrdhzp9kwn7g94jiZ myproject]# pip3 -V
pip 24.1 from /opt/django-cms/.venv/lib64/python3.11/site-packages/pip (python 3.11)  
[root@iZbp1ihrdhzp9kwn7g94jiZ myproject]# python3 -V
Python 3.11.2

处理方式

[root@iZbp1ihrdhzp9kwn7g94jiZ myproject]# yum install python3.11-devel.x86_64
Last metadata expiration check: 3:16:08 ago on Sat 22 Jun 2024 11:35:29 AM CST.
Dependencies resolved.
=========================================================================================================================================================================Package                                     Architecture                      Version                                  Repository                                  Size
=========================================================================================================================================================================
Installing:python3.11-devel                            x86_64                            3.11.2-2.al8                             alinux3-updates                            247 kTransaction Summary
=========================================================================================================================================================================
Install  1 PackageTotal download size: 247 k
Installed size: 929 k
Is this ok [y/N]: y
Downloading Packages:
python3.11-devel-3.11.2-2.al8.x86_64.rpm                                                                                                 1.6 MB/s | 247 kB     00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                    1.6 MB/s | 247 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transactionPreparing        :                                                                                                                                                 1/1Installing       : python3.11-devel-3.11.2-2.al8.x86_64                                                                                                            1/1Running scriptlet: python3.11-devel-3.11.2-2.al8.x86_64                                                                                                            1/1Verifying        : python3.11-devel-3.11.2-2.al8.x86_64                                                                                                            1/1Installed:python3.11-devel-3.11.2-2.al8.x86_64Complete!

再次安装mysqlclient

[root@iZbp1ihrdhzp9kwn7g94jiZ myproject]# pip3.11 install mysqlclient
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting mysqlclientUsing cached http://mirrors.cloud.aliyuncs.com/pypi/packages/79/33/996dc0ba3f03e2399adc91a7de1f61cb14b57ebdb4cc6eca8a78723043cb/mysqlclient-2.2.4.tar.gz (90 kB)Installing build dependencies ... doneGetting requirements to build wheel ... donePreparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mysqlclientBuilding wheel for mysqlclient (pyproject.toml) ... doneCreated wheel for mysqlclient: filename=mysqlclient-2.2.4-cp311-cp311-linux_x86_64.whl size=129246 sha256=e309b42978945dee38d0659de4925f77fd6be0571d97538d1cffd3f31fe043f0Stored in directory: /root/.cache/pip/wheels/de/25/17/4bc7263d99c82ee5323f25d63afe7e53a42302788567bc2bd2
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.2.4

如果对您有帮助,记得关注收藏,帮助更多的人

如果对您有帮助,记得关注收藏,帮助更多的人

这篇关于python3 安装mysqlclient 报错+亲测有用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1085124

相关文章

Python UV安装、升级、卸载详细步骤记录

《PythonUV安装、升级、卸载详细步骤记录》:本文主要介绍PythonUV安装、升级、卸载的详细步骤,uv是Astral推出的下一代Python包与项目管理器,主打单一可执行文件、极致性能... 目录安装检查升级设置自动补全卸载UV 命令总结 官方文档详见:https://docs.astral.sh/

Nexus安装和启动的实现教程

《Nexus安装和启动的实现教程》:本文主要介绍Nexus安装和启动的实现教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、Nexus下载二、Nexus安装和启动三、关闭Nexus总结一、Nexus下载官方下载链接:DownloadWindows系统根

Java SWT库详解与安装指南(最新推荐)

《JavaSWT库详解与安装指南(最新推荐)》:本文主要介绍JavaSWT库详解与安装指南,在本章中,我们介绍了如何下载、安装SWTJAR包,并详述了在Eclipse以及命令行环境中配置Java... 目录1. Java SWT类库概述2. SWT与AWT和Swing的区别2.1 历史背景与设计理念2.1.

安装centos8设置基础软件仓库时出错的解决方案

《安装centos8设置基础软件仓库时出错的解决方案》:本文主要介绍安装centos8设置基础软件仓库时出错的解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录安装Centos8设置基础软件仓库时出错版本 8版本 8.2.200android4版本 javas

Pytorch介绍与安装过程

《Pytorch介绍与安装过程》PyTorch因其直观的设计、卓越的灵活性以及强大的动态计算图功能,迅速在学术界和工业界获得了广泛认可,成为当前深度学习研究和开发的主流工具之一,本文给大家介绍Pyto... 目录1、Pytorch介绍1.1、核心理念1.2、核心组件与功能1.3、适用场景与优势总结1.4、优

conda安装GPU版pytorch默认却是cpu版本

《conda安装GPU版pytorch默认却是cpu版本》本文主要介绍了遇到Conda安装PyTorchGPU版本却默认安装CPU的问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的... 目录一、问题描述二、网上解决方案罗列【此节为反面方案罗列!!!】三、发现的根本原因[独家]3.1 p

windows系统上如何进行maven安装和配置方式

《windows系统上如何进行maven安装和配置方式》:本文主要介绍windows系统上如何进行maven安装和配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不... 目录1. Maven 简介2. maven的下载与安装2.1 下载 Maven2.2 Maven安装2.

Redis指南及6.2.x版本安装过程

《Redis指南及6.2.x版本安装过程》Redis是完全开源免费的,遵守BSD协议,是一个高性能(NOSQL)的key-value数据库,Redis是一个开源的使用ANSIC语言编写、支持网络、... 目录概述Redis特点Redis应用场景缓存缓存分布式会话分布式锁社交网络最新列表Redis各版本介绍旧

MySQL启动报错:InnoDB表空间丢失问题及解决方法

《MySQL启动报错:InnoDB表空间丢失问题及解决方法》在启动MySQL时,遇到了InnoDB:Tablespace5975wasnotfound,该错误表明MySQL在启动过程中无法找到指定的s... 目录mysql 启动报错:InnoDB 表空间丢失问题及解决方法错误分析解决方案1. 启用 inno

Linux下安装Anaconda3全过程

《Linux下安装Anaconda3全过程》:本文主要介绍Linux下安装Anaconda3全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录简介环境下载安装一、找到下载好的文件名为Anaconda3-2018.12-linux-x86_64的安装包二、或者通