在AIX6上的Python3.5.1中连接到MySQL时出现分段错误

2024-07-05 09:25:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着做以下工作: 1在AIX6.0上使用GCC4.2.0编译Python3.5.1源代码; 2使用python3.5.1做我的工作包括connect和使用mysql数据库; 一旦我尝试了这些任务,我就可以成功地编译python3.5.1源代码,并且除了connect和uses数据库之外还做得很好


$/usr/local/bin/python3.5
Python 3.5.1 (default, Aug 12 2016, 15:48:31) 
[GCC 4.2.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> dir(sys.path)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

然后我试着安装PyMySQL-0.7.6,我在Linux和Windows上运行得很好,它安装成功了,但不幸的是,当我试图用它连接到MySQL数据库时,它给了我“Segmentation fault(coredump)”错误,它自动中止python

^{pr2}$

一次又一次,它总是这样的,我读过核心文件,它包含了非人类可读的内容,我不知道问题是,因为我不能用pymysql做,我尝试安装mysql连接器python2.1.3,它安装成功,但我得到了'非法指令(coredump)'错误,它自动中止python


Type "help", "copyright", "credits" or "license" for more information.
>>> import mysql.connector
>>> cnx=mysql.connector.connect(user='sywu',password='sywu',host='150.17.31.113',database='sydb')
Illegal instruction(coredump)
$

有人在aix上成功地完成了这个任务,有什么帮助吗?在


Tags: orimport数据库forinformation源代码licensemore
1条回答
网友
1楼 · 发布于 2024-07-05 09:25:26

我没有使用过AIX,但是从代码片段可以看出,从https://github.com/PyMySQL/PyMySQL/blob/master/example.py可以看出,参数是passwd不是{}。在

import pymysql

conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='', db='mysql')

另外,在同一个库中:https://github.com/PyMySQL/PyMySQL,请看下面的示例。也许它能帮到你。在

相关问题 更多 >