ImportError: No module named MySQLdb

 

解决没有MySqldb的问题,

Traceback (most recent call last):
  File "manage.py", line 5, in <module>
    from platform import app
  File "/CP/BlogSystem/platform.py", line 16, in <module>
    engine = create_engine('mysql://root:root@localhost/db_demo8', echo=True)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/__init__.py", line 424, in create_engine
    return strategy.create(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 81, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 102, in dbapi
    return __import__('MySQLdb')
ImportError: No module named MySQLdb

 

sudo apt-get install python-mysqldb

即解决问题

posted @ 2018-05-31 16:42  Ping_ing  阅读(312)  评论(0编辑  收藏  举报