BananaPi python-Mysql 操作库

时间:2022-02-07 08:50:20

BananPi python-Mysql 操作库

1、首先mysql、python环境安装

2、下载MySQL-python-1.2.3.tar.gz 并解压

tar xfz MySQL-python-1.2.3.tar.gz

3、vi setup_posix.py 编辑配置

去掉注释:mysql_config.path ="/usr/local/mysql/bin/mysql_config"

whereis mysql_config 搜索改为相应路径

注:若没有mysql_config,则需要安装libmysqld-dev

sudo apt-get install libmysqld-dev
sudo apt-get install libmysqlclient-dev

4、切换到MySQL-python-1.2.3目录下

sudo python setup.py build

提示ImportError: No module named setuptools 错误,

安装setuptools-3.2.zip解压

sudo unzip setuptools-3.2.zip

切换到setuptools-3.2目录下

sudo python setup.py build
sudo python setup.py install

5、执行第四步操作sudo python setup.py build
出现error: command 'gcc' failed with exit status 1

sudo apt-get install python-dev libevent-dev
sudo apt-get install libevent-dev

然后在执行第四步

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
centos python 安装MYSQL-python包
执行命令即可:sudo yum install MySQL-python