mysql-python安装
操作系统:ubuntu16.04-gnome
首先要安装mysql数据
sudo apt install mysql-server
我们使用pip进行安装第三方模块
系统python版本为2.7.12,默认没有pip,首先安装pip
sudo apt install python-pip
使用pip安装mysql-python
异常出现了:找不到mysql_config文件
Complete output from command python setup.py egg_info: sh: 1: mysql_config: not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-0PWaDX/mysql-python/setup.py", line 17, in <module> metadata, options = get_config() File "/tmp/pip-build-0PWaDX/mysql-python/setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "/tmp/pip-build-0PWaDX/mysql-python/setup_posix.py", line 25, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found
这是引文,ubuntu中mysql_config不在mysql-server中,我们还需要安装libmysqlclient-dev,mysql_config在这个里面
sudo apt install libmysqlclient-dev
最后再次安装mysql-python
sudo pip install mysql-python
OK,完事儿!