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

相关文章

解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题

《解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题》文章详细描述了在使用lombok的@Data注解标注实体类时遇到编译无误但运行时报错的问题,分析... 目录问题分析问题解决方案步骤一步骤二步骤三总结问题使用lombok注解@Data标注实体类,编译时

linux报错INFO:task xxxxxx:634 blocked for more than 120 seconds.三种解决方式

《linux报错INFO:taskxxxxxx:634blockedformorethan120seconds.三种解决方式》文章描述了一个Linux最小系统运行时出现的“hung_ta... 目录1.问题描述2.解决办法2.1 缩小文件系统缓存大小2.2 修改系统IO调度策略2.3 取消120秒时间限制3

python管理工具之conda安装部署及使用详解

《python管理工具之conda安装部署及使用详解》这篇文章详细介绍了如何安装和使用conda来管理Python环境,它涵盖了从安装部署、镜像源配置到具体的conda使用方法,包括创建、激活、安装包... 目录pytpshheraerUhon管理工具:conda部署+使用一、安装部署1、 下载2、 安装3

解决systemctl reload nginx重启Nginx服务报错:Job for nginx.service invalid问题

《解决systemctlreloadnginx重启Nginx服务报错:Jobfornginx.serviceinvalid问题》文章描述了通过`systemctlstatusnginx.se... 目录systemctl reload nginx重启Nginx服务报错:Job for nginx.javas

龙蜥操作系统Anolis OS-23.x安装配置图解教程(保姆级)

《龙蜥操作系统AnolisOS-23.x安装配置图解教程(保姆级)》:本文主要介绍了安装和配置AnolisOS23.2系统,包括分区、软件选择、设置root密码、网络配置、主机名设置和禁用SELinux的步骤,详细内容请阅读本文,希望能对你有所帮助... ‌AnolisOS‌是由阿里云推出的开源操作系统,旨

Ubuntu系统怎么安装Warp? 新一代AI 终端神器安装使用方法

《Ubuntu系统怎么安装Warp?新一代AI终端神器安装使用方法》Warp是一款使用Rust开发的现代化AI终端工具,该怎么再Ubuntu系统中安装使用呢?下面我们就来看看详细教程... Warp Terminal 是一款使用 Rust 开发的现代化「AI 终端」工具。最初它只支持 MACOS,但在 20

mysql-8.0.30压缩包版安装和配置MySQL环境过程

《mysql-8.0.30压缩包版安装和配置MySQL环境过程》该文章介绍了如何在Windows系统中下载、安装和配置MySQL数据库,包括下载地址、解压文件、创建和配置my.ini文件、设置环境变量... 目录压缩包安装配置下载配置环境变量下载和初始化总结压缩包安装配置下载下载地址:https://d

LinuxMint怎么安装? Linux Mint22下载安装图文教程

《LinuxMint怎么安装?LinuxMint22下载安装图文教程》LinuxMint22发布以后,有很多新功能,很多朋友想要下载并安装,该怎么操作呢?下面我们就来看看详细安装指南... linux Mint 是一款基于 Ubuntu 的流行发行版,凭借其现代、精致、易于使用的特性,深受小伙伴们所喜爱。对

Linux(Centos7)安装Mysql/Redis/MinIO方式

《Linux(Centos7)安装Mysql/Redis/MinIO方式》文章总结:介绍了如何安装MySQL和Redis,以及如何配置它们为开机自启,还详细讲解了如何安装MinIO,包括配置Syste... 目录安装mysql安装Redis安装MinIO总结安装Mysql安装Redis搜索Red

python安装完成后可以进行的后续步骤和注意事项小结

《python安装完成后可以进行的后续步骤和注意事项小结》本文详细介绍了安装Python3后的后续步骤,包括验证安装、配置环境、安装包、创建和运行脚本,以及使用虚拟环境,还强调了注意事项,如系统更新、... 目录验证安装配置环境(可选)安装python包创建和运行Python脚本虚拟环境(可选)注意事项安装