Use mysql database in django virtualenv, python 3.5 django1.10 mysql 5.7.17, djangovirtualenv

Source: Internet
Author: User
Tags django virtualenv virtualenv

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.