CentOs 下安装python的MySQLdb
来源:互联网 发布:英魂之刃英雄数据库 编辑:程序博客网 时间:2024/06/05 20:35
进入python的命令行,输入 import MySQLdb 如果没有报错,证明此模块已经安装,
wget -O python-1.2.3c1.tar.gz http://cdnetworks-kr-1.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz
出现报错:ImportError: No module named setuptools
安装setuptools
wget -O setuptools-0.6c8.tar.gz http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz
cd setuptools-0.6c8
python setup.py build
sudo python setup.py install
报错:mysql_config not found
使用whereis mysql命令找到mysql安装目录,假设mysql安装在/usr/local/mysql
回到MySQLdb源码目录.
vi setup_posix.py 或 vim setup_posix.py打开配置文件。此时,找到mysql_config.path 一行,把路径前面加上第9步的mysql安装路径,bin目录。即mysql_config.path = "/usr/local/mysql/bin/mysql_config"
In file included from _mysql.c:29:pymemcompat.h:10:20: error: Python.h: No such file or directory_mysql.c:30:26: error: structmember.h: No such file or directoryIn file included from /usr/include/mysql/mysql.h:44,from _mysql.c:40:..._mysql.c:2808: warning: return type defaults to 'int'_mysql.c: In function 'DL_EXPORT':_mysql.c:2808: error: expected declaration specifiers before 'init_mysql'_mysql.c:2886: error: expected '{' at end of inputerror: command 'gcc' failed with exit status 1
需要安装install python-dev package:yum install python-devel
安装完成后,import MySQLdb时:>>> import MySQLdbTraceback (most recent call last):File "", line 1, in File "MySQLdb/__init__.py", line 19, in import _mysqlFile "build/bdist.linux-i686/egg/_mysql.py", line 7, in File "build/bdist.linux-i686/egg/_mysql.py", line 6, in __bootstrap__ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
vim /etc/ld.so.conf
加入:libmysqlclient_r.so.16所在目录
ldconfig -v
ok了
- CentOs 下安装python的MySQLdb
- CentOs下安装 python 的 Mysqldb
- CentOS下安装python-mysqldb
- CentOS下python-mysqldb安装
- Centos下安装python mysqldb
- CentOS下安装python-mysqldb
- CentOS下安装python-mysqldb
- Centos下安装python的MySQLdb模块若干错误总结
- CentOS下安装python-mysqldb(转)
- centos下安装python扩展MySQLdb
- centos下安装Python之MySQLdb
- Centos下python安装 MySQLdb报错
- Centos下python安装 MySQLdb报错
- 在centos下安装python MySQLdb
- CentOS下安装MySQLdb
- CentOS 安装python MySQLdb模块
- centos系统下为python安装MySQLdb库
- windows 下安装 python 的 mysqldb 模块
- hdu 4497 GCD and LCM (素数分解+组合数学)
- 黑马程序员——三、java基础之面向对象.part1(4)
- 动态规划问题
- 鸡蛋硬度测试
- 函数指针
- CentOs 下安装python的MySQLdb
- 在ios后台运行
- Knight Tour 骑士走棋盘算法(附代码)
- php 网站重定向 数据提交
- Jquery中的序列化
- 用虚拟总线来实现的MINI2440 LED驱动
- Linux系统调用的实现机制分析
- 用VS做汇编开发环境的方法
- 解决URL java.io.FileNotFoundException: http://......