文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

python 2.6.6安装MySQL-

2023-01-31 07:10

关注

1.下载安装setuptools

[root@localhost opt]#wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz

[root@localhost opt]#tar xzf setuptools-0.6c8.tar.gz

[root@localhost setuptools-0.6c8]# python setup.py build

[root@localhost setuptools-0.6c8]# python setup.py install

2.下载安装MySQL-python

[root@localhost opt]# wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download

[root@localhost opt]# cd MySQL-python-1.2.3/

[root@localhost MySQL-python-1.2.3]# python setup.py build

报错信息:...

         _mysql.c:2091: error: ‘r’ undeclared (first use in this function)

         _mysql.c:2091: error: ‘_mysql_ResultObject’ has no member named ‘result’

         _mysql.c:2092: error: ‘_mysql_ResultObject’ has no member named ‘result’

         _mysql.c: In function ‘_mysql_ResultObject_dealloc’:

         _mysql.c:2100: warning: implicit declaration of function ‘mysql_free_result’

         _mysql.c:2100: error: ‘_mysql_ResultObject’ has no member named ‘result’

         _mysql.c: At top level:

         _mysql.c:2331: error: ‘_mysql_ConnectionObject’ has no member named ‘open’

         _mysql.c:2338: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’

         _mysql.c:2345: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’

         _mysql.c:2352: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’

         _mysql.c:2359: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’

         _mysql.c:2422: error: ‘_mysql_ResultObject’ has no member named ‘converter’

         _mysql.c:2422: error: initializer element is not constant

         _mysql.c:2422: error: (near initialization for ‘_mysql_ResultObject_memberlist[0].offset’)

         _mysql.c: In function ‘_mysql_ConnectionObject_getattr’:

         _mysql.c:2444: error: ‘_mysql_ConnectionObject’ has no member named ‘open’

         error: command 'gcc' failed with exit status 1

解决方法:yum -y install mysql-devel libxml2 libxml2-dev libxslt* zlib gcc openssl

[root@localhost MySQL-python-1.2.3]# python setup.py install

3.测试

[root@localhost MySQL-python-1.2.3]# python

Python 2.6.6 (r266:84292, May 24 2013, 21:09:02)

[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import MySQLdb

/usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-linux-x86_64.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-linux-x86_64.egg/_mysql.pyc, but /opt/MySQL-python-1.2.3 is being added to sys.path

解决方法:

[root@localhost MySQL-python-1.2.3]# cd ..

[root@localhost opt]# python

Python 2.6.6 (r266:84292, May 24 2013, 21:09:02)

[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import MySQLdb

>>>


阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯