In the Anaconda, MySQLdb was sealed in Mysql-python.
So first run Conda install Mysql-python in Anaconda prompt. (Note to right-click the Administrator)
Sometimes there is a connection problem because it is a foreign site, you can set up in the environment Tsinghua to the mirror path.
After installation, the direct import mysqldb is OK.
Set up a domestic mirror
If you need to install a lot of packages, you will find that Conda download is often very slow, because anaconda.org server is abroad. Fortunately, the Tsinghua tuna image source has a anaconda warehouse image, we add it to the Conda configuration:
1 # Add a anaconda tuna mirror 2 conda config--add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 3 # Tuna's help in the mirror address with quotation marks, need to remove 4 5 # Set the channel address to be displayed when searching 6 Conda config--set show_channel_urls Yes
After executing the above command, a ~/.condarc (LINUX/MAC) or C:usersuser_name.condarc file is generated, which records our configuration of the Conda, and it is the same effect to manually create and edit the file directly.
Anaconda Installing the MySQLdb module