Home > Backend Development > Python Tutorial > Linux环境下MySQL-python安装过程分享

Linux环境下MySQL-python安装过程分享

WBOY
Release: 2016-06-06 11:21:19
Original
1319 people have browsed it

1. 首先确认python的版本为2.3.4以上,如果不是需要升级python的版本

  python -V   检查python版本

2. 安装mysql, 比如安装在/usr/local/mysql目录下

3. 下载 MySQL-python-1.2.2.tar.gz
    地址 https://sourceforge.net/projects/mysql-python/

4. 安装 MySQl-python

代码如下:


    tar xvzf MySQL-python-1.2.2.tar.gz
    cd MySQL-python-1.2.2
    vi site.cfg


    把 mysql_config = /usr/local/mysql/bin/mysql_config 这一行前的#去掉,并且把mysql_config的路径设置正确。

代码如下:


    python setup.py build
    sudo python setup.py install


    安装结束

5. 测试

    运行: python
    

代码如下:


    import MySQLdb
    

    如果没有报错,说明安装好了。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template