Configure mysql-python in Mac

Source: Internet
Author: User

It seems that it is not easy to make such a good job. Record it here.

  1. Click to download the python driver of MySQL.
  2. Decompress the downloaded file.
  3. In the terminal, go to the decompressed file directory, which contains site. cfg to open the configuration file.
  4. Mysql_config in is commented out. Remove the comment and change it to the path under mysql. My name is mysql_config =/usr/local/MySQL/bin/mysql_config.
  5. Switch to the above directory on the terminal and use $ Python setup. py build.
  6. Then $ Python setup. py install.
  7. If the error persists, it is okay.
  8. However, if you want to directly import data on the terminal, an error may be returned:Library not loaded: libmysqlclient.18.dylib.
  9. In this case, use $ sudo ln-S/usr/local/MySQL/lib/libmysqlclient.18.dylib/usr/lib to link the Library to the/usr/lib directory.
  10. And then import the data. Basically, it's OK.
Related Article

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.