ImportError: No module named MySQLdb

2021-02-20 16:35发布

 

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

即解决问题

标签: