gpt4 book ai didi

php - 需要在有 cPanel 的服务器中安装 mysql-devel - `libmysqlclient_16' 未找到

转载 作者:行者123 更新时间:2023-11-29 18:11:56 24 4
gpt4 key购买 nike

我在cPanel中有一个Python脚本,需要将我的脚本连接到MYSQL,为了将Python连接到MYSQL,我需要有libmysqlclient

当我运行代码时,系统显示以下错误

File "/usr/lib64/python3.6/site-packages/MySQLdb/init.py", line 19, in <module>
import _mysql
ImportError: /usr/lib64/libmysqlclient.so.18: version `libmysqlclient_16' not found (required by /usr/lib64/python3.6/site-packages/_mysql.cpython-36m-x86_64-linux-gnu.so)
  • 服务器操作系统:Centos 6.9
  • cpanel 版本:68.0.13

/usr/lib64中的libmysqlclient列表

/usr/lib64/libmysqlclient_r.so.15
/usr/lib64/libmysqlclient.so
/usr/lib64/libmysqlclient.so.16.0.0
/usr/lib64/libmysqlclient_r.so.16.0.0
/usr/lib64/libmysqlclient.so.15.0.0
/usr/lib64/libmysqlclient_r.so.18
/usr/lib64/libmysqlclient_r.so.18.1.0
/usr/lib64/libmysqlclient.so.15
/usr/lib64/libmysqlclient_r.so.15.0.0
/usr/lib64/mysql/libmysqlclient.a
/usr/lib64/mysql/libmysqlclient_r.a
/usr/lib64/libmysqlclient.so.16
/usr/lib64/libmysqlclient_r.so
/usr/lib64/libmysqlclient_r.so.16
/usr/lib64/libmysqlclient.so.18
/usr/lib64/libmysqlclient.so.18.1.0

最佳答案

您可以使用mysql.connector

在 ubuntu 上:sudo apt-get install python-mysql.connectorpython3-mysql.connector for python 3

然后:

import mysql.connector
mysql.connector.connect(host='localhost',database='mysql',user='root',password='')

关于php - 需要在有 cPanel 的服务器中安装 mysql-devel - `libmysqlclient_16' 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47315920/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com