Use mysql database in django virtualenv, python 3.5 django1.10 mysql 5.7.17, djangovirtualenv
-- Python3.5
-- Django1.10
-- MySQL5.7.17
Three drivers are recommended in the official documentation.
MySQLdb
Mysqlclient
MySQL Connector/Python
The first one does not support 3.x pip3 installation. The error message "ConfigParser" is missing.
Some people say that because the module name has been changed to configparser, cp can be used only once. But I tried it. No, but I still said I didn't have this module.
Try to use mysqlclient,
Pip3 install mysqlclient
Succeeded
No virtual environment is required.
However, downloading in the virtual environment will fail, and the mysql_config is missing.
According to stackoverflow,
Environment Variables configured
Download MySQL-Python.
Pipy check. 3. x... is not supported...
The last MySql official one won't work either. In the virtual environment, it will be said that there is no MySqlDb
Try to modify _ init __according to the following idea and find the method in the module. No method can be used.
You can use pymysql in the virtualenv Virtual Environment
The _ init _ file under the project needs to be modified.
Add
Import pymysql
Pymysql. install_as_MySQLdb ()
Thanks http://www.maiziedu.com/article/8272/
Later, the article said that pymysql needs to be installed on GitHub. It is no longer needed and pip can be started normally.