执行python报错No module named MySQLdb

执行python报错

Traceback (most recent call last):
  File "zabbix.py", line 6, in <module>
    import MySQLdb
ImportError: No module named MySQLdb

解决办法:

  1. easy_install mysql-python (mix os)
  2. pip install mysql-python (mix os)
  3. apt-get install python-mysqldb (Linux Ubuntu)
  4. cd/usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)
  5. yum install MySQL-python (linux Fedora, CentOS)
  6. pip install mysqlclient (Windows)

发表评论

登录... 后才能评论