Resolve Python2 Installation Mysql-python module error

Source: Internet
Author: User

Today's computer reload system, all the software is re-installed, MYSQLDB module has been installed bad, tangled for a long time, finally solved, methods to share to everyone. MYSQLDB Module Installation:

1, download Mysql-pyhon module, the website is: https://pypi.python.org/pypi/MySQL-python/

2, decompression, enter the directory, modify the Site.cfg file 13 lines, uncomment, the original path mysql_config =/usr/local/bin/mysql_config, changed to a new Mysql_config =/usr/local/mysql/ Bin/mysql_config (mysql_config path, not known can use the Whereis Command query path), save;

3, modify the setup_posix.py file 27th line, the original path Mysql_config.path = "Mysql_config" changed to Mysql_config.path = "/usr/local/mysql/bin/mysql_ Config ", save;

4, the Export dyld_library_path=/usr/local/mysql/lib/(path for the MySQL installation path, the completion of their own MySQL installation path can be) to join the current user home directory. Bash_profile or/etc/ Profile file,. bash_profile is the environment variable for the currently logged-on user,/etc/profile is the system environment variable, and then executes the command soure. Bash_profile or Source/etc/profile;

5, install, execute Python setup.py build and python setup.py install;

6, verification, enter the Python interactive command line, import MySQLdb, no error is installed success;

7. This solution is suitable for MacOSX, Centos, Redhat, Ubuntu, Windows.

Resolve Python2 Installation Mysql-python module error

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.