centos 6.5 安装MySQL-python模块
2017-01-23 15:05
573 查看
如果你服务器环境允许yum,安装MySQL-python模块就很简单了
[python] view
plain copy
yum install MySQL-python -y
当然也可以源码安装该模块
首先安装 setuptools,下载源代码包:
[plain] view
plain copy
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
解压后
python setup.py build
python setup.py install
然后安装一些扩展库
[plain] view
plain copy
yum -y install rpm-build gcc-c++ mysql-devel python-devel
最后安装MySQL-python
[plain] view
plain copy
下载源代码包:
wget http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
解压进入安装目录。
编辑 site.cfg ,把 mysql_config 那一行取消注释,并改为:
mysql_config = /usr/lib64/mysql/mysql_config (根据自己mysql安装位置定义)
python setup.py build
python setup.py install
测试安装
[plain] view
plain copy
[root@woyoo:/tmp/MySQL-python-1.2.3]# python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/usr/lib64/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/lib64/python2.6/site-packages/MySQL_python-1.2.3-py2.6-linux-x86_64.egg/_mysql.pyc, but /tmp/MySQL-python-1.2.3 is being added to sys.path
>>>
报出一大堆警告信息,解决办法:删除MySQL-python源目录,再测试一下:
[python] view
plain copy
yum install MySQL-python -y
当然也可以源码安装该模块
首先安装 setuptools,下载源代码包:
[plain] view
plain copy
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
解压后
python setup.py build
python setup.py install
然后安装一些扩展库
[plain] view
plain copy
yum -y install rpm-build gcc-c++ mysql-devel python-devel
最后安装MySQL-python
[plain] view
plain copy
下载源代码包:
wget http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
解压进入安装目录。
编辑 site.cfg ,把 mysql_config 那一行取消注释,并改为:
mysql_config = /usr/lib64/mysql/mysql_config (根据自己mysql安装位置定义)
python setup.py build
python setup.py install
测试安装
[plain] view
plain copy
[root@woyoo:/tmp/MySQL-python-1.2.3]# python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/usr/lib64/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/lib64/python2.6/site-packages/MySQL_python-1.2.3-py2.6-linux-x86_64.egg/_mysql.pyc, but /tmp/MySQL-python-1.2.3 is being added to sys.path
>>>
报出一大堆警告信息,解决办法:删除MySQL-python源目录,再测试一下:
相关文章推荐
- centos 6.5 安装MySQL-python模块
- CentOS6.5上python-mysql环境的安装问题解决
- Centos 安装python MySQL 模块 -- MySQLdb
- centos7 安装mysql--python模块出现EnvironmentError: mysql_config not found和error: command 'gcc' failed with exit status 1
- centos6.5上安装nginx+python+mysql+ uwsgi开发环境
- CentOS 6.5升级Python版本、修复yum和安装模块
- Python之——病毒检测模块pyClamad的安装(基于CentOS 6.5系统)
- ubuntu下mysql-python模块的安装
- 64位centos下安装python的PIL模块
- ubuntu 下 python mysql模块安装
- CentOS 6.5 系统 LAMP(Apache+MySQL+PHP)安装步骤
- centos6 下安装MySQL-python
- 在Python安装MySQL支持模块的方法
- [CentOS]安装MySQL-python,error: Setup script exited with error: command 'gcc' failed with exit status
- python mysql 模块安装使用
- rpm安装MySQL5.5后配置,在centos5上;mysql编译安装在centos6.5上;
- 从0零开始学slatstack-(0)在centos 6.5 安装 python2.7 salt
- linux(centos/ubuntu) python27 mysql安装 MySQLdb
- Centos环境下MySQL-python安装过程
- 在Python安装MySQL支持模块的方法