python安装mysqldb

发布时间:2019-08-06 13:56:23编辑:auto阅读(1805)

    1.安装setuptools-0.6c11

    wget --no-check-certificate  http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
    tar zxf setuptools-0.6c11.tar.gz && cd setuptools-0.6c11
    python setup.py build
    python setup.py install

    2.安装MySQL-python-1.2.3

    wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download
    tar zxf MySQL-python-1.2.3.tar.gz && cd MySQL-python-1.2.3
    python setup.py build
    python setup.py install

    如果在执行python setup.py build时,报EnvironmentError: mysql_config not found的话,先查找mysql_config的位置,使用find / -name mysql_config,我的是在/usr/local/mysql/bin/mysql_config,然后修改MySQL-python-1.2.3目录下的site.cfg文件,去掉mysql_config=XXX这行的注释,并改成mysql_config=/usr/local/mysql/bin/mysql_config,以自己机器的为准.

    再执行下面命令就可以了

    python setup.py build
    python setup.py install


关键字

上一篇: apache+mod-python

下一篇: Python ConfigParser的