Install MySQLdb using Python in the Fedora Environment

Source: Internet
Author: User

I am from Fedora. If it is another one, it is slightly different on the command line.

1. Install the database driver Adapter


2. Unzip the package and install the package. problems may occur during installation.

  1. Python setup. py install (generally it will fail)
Because setuptools is used for installation, install setuptools first.
  1. Python
After setuptools is installed, execute the preceding statement.
  1. Python setup. py install
An error may be reported, that is, _ mysql. c.
  1. Building'_ Mysql'Extension
  2. Gcc-pthread-fno-strict-aliasing-O2-g-pipe-Wall-Wp,-D_FORTIFY_SOURCE =2-Fexceptions-fstack-protector -- param = ssp-buffer-size =4-M32-march = i686-mtune = atom-fasynchronous-unwind-tables-D_GNU_SOURCE-fPIC-fwrapv-DNDEBUG-O2-g-pipe-Wall-Wp,-D_FORTIFY_SOURCE =2-Fexceptions-fstack-protector -- param = ssp-buffer-size =4-M32-march = i686-mtune = atom-fasynchronous-unwind-tables-D_GNU_SOURCE-fPIC-fwrapv-fPIC-Dversion_info = (1,2,3,'Final',0)-D _ version __=1.2.3-I/usr/include/mysql-I/usr/include/python2.7-C _ mysql. c-o build/temp. linux-i686-2.7/_ Mysql. o-g-pipe-Wp,-D_FORTIFY_SOURCE =2-Fexceptions-fstack-protector -- param = ssp-buffer-size =4-M32-fasynchronous-unwind-tables-D_GNU_SOURCE-D_FILE_OFFSET_BITS =64-D_LARGEFILE_SOURCE-fno-strict-aliasing-fwrapv-fPIC-g-static-libgcc-fno-omit-frame-pointer-fno-strict-aliasing-DMY_PTHREAD_FASTMUTEX =1
  3. In file encoded DEDFrom/Usr/include/mysql/my_config.h:16:0,
  4. From_ Mysql. c:36:
In this case, you only need to install mysql-dev and python-dev.
  1. Yum install mysql-dev *
  2. Yum install python-dev *

Try again. I succeeded. What about you?

  1. Python setup. py install

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: 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.