Install mysql-pytho in Ubuntu

  1. First of all, you have to make sure that the Ubuntu update source can be used. The Ubuntu 14.04 source tested in this article, the lower version of Ubuntu has not been tried. After all, labor and management are not testers.

For safety's sake cp /etc/apt/source.list /etc/apt/source.list.bak

The following is the source of Ubuntu 14.04, (please find the source of other versions by yourself) Write the following to /etc/apt/source.list

deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

  1. sudo apt-get update

  2. sudo apt-get install mysql-python

Found an error:

sh: mysql_config: not found

Traceback (most recent call last):

File "setup.py", line 15, in

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

  1. The specific reason is that the installation program cannot find the mysql_config file under /usr/bin/.

The solution found on the Internet generally means that you don't have libmysqld-dev or libmysqlclient-dev, but they all exist after checking.

  1. First of all, an important python-dev is generally not installed, so you need sudo apt-get install python-dev

After that, I continued to install mysql-python and found that it still didn't work.

  1. Reinstall libmysqlclient-dev,

The miracle finally appeared:

Recommended Posts

Install mysql-pytho in Ubuntu
Install python in Ubuntu
Install JDK in Ubuntu19.10
Install VMware Tools in Ubuntu 18.04
How to install mysql in Ubuntu 14.04
Install and configure Docker in Ubuntu
How to install mysql in Ubuntu 14.04
ubuntu18.04 install python2
ubuntu18.04 install docker
ubuntu12.04 install python3
Ubuntu install guide
ubuntu install nodejs
ubuntu 16 install asp.net
ubuntu install leanote
ubuntu install Jenkins
docker install ubuntu
ubuntu install elasticsearch
ubuntu16.0.1 install pagoda
ubuntu18.04 install python
ubuntu 18.04 install teamviewer
ubuntu install sendmail
How to install cuda10.1 driver in Ubuntu
How to install ROS Noetic in Ubuntu20.04
Install Ubuntu 18.04 in the virtual machine VMware
Install jetty in Ubuntu 18.04 Server, non-apt version
Install gsl package in R language on ubuntu
Install apache+PHP under Ubuntu
install vscode on ubuntu18
Install node.js under Ubuntu
Nagios3 in ubuntu serve
ubuntu install zsh terminal
Install Redis on Ubuntu
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install python3.6 under Ubuntu 16.04
Install docker on Ubuntu
Install MySQL5.7 in centos7
Install php in centos
Ubuntu18.04 install opencv 3.2.0 solution
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
How to install python in ubuntu server environment
ubuntu install harbor warehouse
Use supervisor in ubuntu
Install mysql on Ubuntu 14.04
Ubuntu16.04 install Mongodb tutorial
Install Django on ubuntu
Install Pytorch+CUDA on Ubuntu 16.04
2018-09-11 Install arduino under Ubuntu
Install Python3 on Ubuntu 14.04
Install Python3 environment in a brand new Ubuntu
Ubuntu18.04 install Asterisk16.10 + FreePBX15.0
Ubuntu19 install MySQL pit
ubuntu16.04 install node.js, npm
Install rJava on Ubuntu18
Install redis5.0 in CentOS7