当前位置:Gxlcms > 数据库问题 > ubuntu安装mysql-python

ubuntu安装mysql-python

时间:2021-07-01 10:21:17 帮助过:23人阅读


 将以下的内容写到/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

2. sudo apt-get update

3.sudo apt-get install mysql-python

   发现报错了:

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


4.详细原因是安装程序在/usr/bin/下找不到mysql_config文件。

在网上查的解决方法,通常是说你没有libmysqld-dev 或libmysqlclient-dev 。但是查了一下发现都存在。

技术分享

5.首先一个重要的python-dev一般都没有安装,所以须要sudo apt-get install python-dev

完事继续安装mysql-python,发现还是不行。

6.重装libmysqlclient-dev,

   奇迹最终出现了:

技术分享

ubuntu安装mysql-python

标签:style   fill   ports   rust   upd   file   重装   home   app   

人气教程排行