总是得到:ImportError:没有名为'MySQLdb'的模块

时间:2017-08-16 03:20:33

标签: python mysql

我的代码在MacOS X上运行(10.12.5):

from sqlalchemy import create_engine

engine = create_engine('mysql+mysqldb://root@localhost:3306/blog')

print(engine)

问题:

File "database.py", line 3, in <module>
engine =create_engine('mysql+mysqldb://root@localhost:3306/louis')

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sqlalchemy/engine/__init__.py", line 387, in create_engine
    return strategy.create(*args, **kwargs)

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sqlalchemy/engine/strategies.py", line 80, in create
dbapi = dialect_cls.dbapi(**dbapi_args

File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 110, in dbapi
return __import__('MySQLdb')

ImportError: No module named 'MySQLdb'

0 个答案:

没有答案