ImportError: No module named MySQLdb

纵饮孤独 提交于 2021-02-20 16:46:26

 

解决没有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

即解决问题

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!