{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## No module named 'MySQLdb' error\n", "\n", "- 이 에러는 python2에서 사용하던 코드를 python3에서 사용하는 경우 생기는 에러\n", "\n", "\n", "## 해결방법\n", "- pip3 install pymysql\n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "try:\n", " import pymysql\n", " pymysql.install_as_MySQLdb()\n", "except ImportError:\n", " pass" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "Base.metadata.create_all(create_engine('This://'))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- This에 'mysql+pymysql'을 추가해주면 정상적으로 작동" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }