zoukankan      html  css  js  c++  java
  • python MySQLdb

    这个MySQLdb就是python操作MySQL数据库的模块

    所以,你得先安装它,默认是没安装

    一. 安装libmysqlclient-dev

    #apt-get update

    #apt-get install libmysqlclient-dev

    二.安装setuptools

    https://pypi.python.org/pypi/setuptools/

    setuptools-36.7.0.zip

    #unzip setuptools-36.7.0.zip

    #cd setuptools-36.7.0

    #python setup.py build

    #python setup.py install

    三.安装MySQL-python

    https://pypi.python.org/pypi/MySQL-python/1.2.5

    MySQL-python-1.2.5.zip

    #cd MySQL-python-1.2.5

    #vim setup_posix.py

    修改mysql_config.path = “mysql_config"

    为mysql_config.path = "/usr/bin/mysql_config"

    #python setup.py build

    #python setup.py install

    四.验证

    # python

    Python 2.7.14 (default, Nov  1 2017, 00:48:15)

    [GCC 4.8.4] on linux2

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

    >>> import MySQLdb

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

    OK,已经正确安装python的MySql模块

  • 相关阅读:
    心得
    第七章
    第六章
    第五章
    第四章
    第三章
    第二章
    第一章
    实验2(4)
    实验2(3)
  • 原文地址:https://www.cnblogs.com/woodzcl/p/7815970.html
Copyright © 2011-2022 走看看