Ubuntu16.04 installation MySQLdb

Source: Internet
Author: User

Operations performed under the Buntu system

The PIP tool is installed first

1 sudoapt-get installpython-pip

Then use

1 sudopip install mysql-python

Install a third-party library. But this error

123456789 sh: mysql_config: not foundTraceback (most recent call last): File "setup.py", line 15, in <module>  metadata, options = get_config() File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config  libs = mysql_config("libs_r") File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config  raise EnvironmentError("%s not found" % (mysql_config.path,))EnvironmentError: mysql_config not found

The reason is that there is no installation: Libmysqlclient-dev

1 sudoapt-get install libmysqlclient-dev

Error: Import MySQLdb

Importerror:no module named MySQLdb

Installation: Apt-get Install PYTHON-MYSQLDB

If Python3, replace Python with Python3,pip and replace with PIP3 when installed above

Article reference: http://blog.sina.com.cn/s/blog_74a7e56e0101a7qy.html

Ubuntu16.04 installation MySQLdb

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.