Home > Backend Development > Python Tutorial > python installation mysql-python concise notes (ubuntu environment)

python installation mysql-python concise notes (ubuntu environment)

WBOY
Release: 2016-07-06 13:29:53
Original
1089 people have browsed it

This article describes how to install mysql-python in python. Share it with everyone for your reference, the details are as follows:

Operations under ubuntu system

First installed the pip tool

sudo apt-get install python-pip

Copy after login

Then use

sudo pip install mysql-python

Copy after login

Install third-party libraries. But an error is reported at this time

sh: mysql_config: not found
Traceback (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

Copy after login

The reason is that: libmysqlclient-dev

is not installed
sudo apt-get install libmysqlclient-dev

Copy after login

Continue the installation and find that an error is still reported

mysql.c:29:20: fatal error: Python.h: There is no such file or directory, and the Python header file cannot be found. Does wheezy not install the python development package by default?

sudo dpkg -l | grep python-dev

Copy after login

Sure enough, it doesn’t exist, you really need to install it:

sudo apt-get install python-dev

Copy after login

MySQL-python can be compiled and passed.

Readers who are interested in more Python-related content can check out the special topics on this site: "Summary of Python Image Operation Skills", "Python Data Structure and Algorithm Tutorial", "Python Socket Programming Skills Summary", "Python Function Using Skills Summary" ", "Python String Operation Skills Summary", "Python Introduction and Advanced Classic Tutorial" and "Python File and Directory Operation Skills Summary"

I hope this article will be helpful to everyone in Python programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template