1.先安装python2.7
wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz
tar xf Python-2.7.14.tgz
cd Python-2.7.14
./configure --prefix=/usr/local/
make && make install
2.安装mysql-python
/usr/local/bin/pip install mysql-python
报mysql_config没有找到
[root@audio-web02.yp bin]# /usr/local/bin/pip2.7 install mysql-pythonCollecting mysql-python Using cached MySQL-python-1.2.5.zip Complete output from command python setup.py egg_info: sh: mysql_config: command not found Traceback (most recent call last): File "", line 1, inFile "/tmp/pip-build-1knvgC/mysql-python/setup.py", line 17, inmetadata, options = get_config()
File "/tmp/pip-build-1knvgC/mysql-python/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-1knvgC/mysql-python/setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-1knvgC/mysql-python/
需要安装mysql-devel
yum install mysql-devel -y
发现有冲突,先删除本地的remi源,然后重新安装
rm -f remi-mirror.repo
安装mysql-python
/usr/local/bin/pip2.7 install mysql-python
发现有个缺少库的报错
手动复制库文件
cp /usr/lib64/libmysqlclient_r.so.16.0.0 /usr/lib64/mysql/ && cp /usr/lib64/libmysqlclient.so.16.0.0 /usr/lib64/mysql/
安装成功