Mysql-python Installation

Source: Internet
Author: User

[Email protected] ~]# [[email protected] ~]# [[email protected] ~]# gcc-v See if GCC is installed if an error is not Installation

[[email protected] ~]# yum-y install GCC installation gcc

[Email protected] ~]# wget http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/ Mysql-python-1.2.4b4.tar.gz?use_mirror=ncu Download Package

[email protected] ~]# tar zxvf mysql-python-1.2.4b4.tar.gz cd mysql-python-1.2.4b4 Unpacking Packages

Unzip the package to/usr/local/src/

Enter/USR/LOCAL/SRC/MYSQL-PYTHON-1.2.4B4

[[email protected] mysql-python-1.2.4b4]# Find/-name mysql_config view mysql_config file location/usr/local/mysql/bin/mysql_config[[email protected] ~]# vim site.cfg Enter site.cfg config file for modification

# Embedded:link against the embedded server Library # Threadsafe:use The Threadsafe client # Static:link against a stat IC Library (probably required for embedded)

Embedded = False

Threadsafe = False (change to false)

static = False

# The path to Mysql_config. # Only the use of this if mysql_config isn't on the your PATH, or you had some weird # setup that requires it.

Mysql_config =/usr/local/mysql/bin/mysql_config (Before the # is removed and the path is changed correctly)

To install at the end:

# python setup.py build
# python setup.py installWhen you are finished, go to Python>>> Import MySQLdbIf there is an error: Traceback (most recent):
File "<stdin>", line 1, in <module>
File "mysqldb/__init__.py", line A, in <module>
Import _mysql
Importerror:libmysqlclient.so.20:cannot open Shared object file:no such file or directory based on the last hint, you should be unable to find a delivery Libmysqlclien t.so.20 file, then find this file in the MySQL installation directory and make a soft connection to the/usr/lib[email protected] lib]# ln-s/usr/local/mysql/lib/libmysqlclient.so.20/usr/lib/libmysqlclient.so.20Import the module again and it's done.

Mysql-python Installation

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.