安装连接器 mysql 为了 python 3 在 raspberry pi

我很新用来 raspberry pi.
我有一个程序 python 3.4, 连接到服务器上的数据库 hostinger.
我想安装连接器 mysql 在 raspberry pi. 我正在寻找很多,但我找不到答案 . 任何帮助将不胜感激
已邀请:

莫问

赞同来自:

在安装之前,开始更新非常重要。



更新

;


sudo apt-get update
sudo apt-get upgrade


或者

安装连接器

Python 2

;


sudo apt-get -y install python-mysql.connector


或者

安装连接器

Python 3

;


sudo apt-get -y install python3-mysql.connector

小明明

赞同来自:

我没有找到安装的方法 mysql-connector-python, 我与之使用过 windows.
为了 python 3.4 我使用了命令


sudo python3 -m pip install pymysql


为了 python 2.7 您可以使用以下命令。


sudo apt-get install python-mysqldb


或者


sudo apt-get install python-pip
pip install pymysql

帅驴

赞同来自:

刚使用 $sudo apt-get install python3-mysqldb, 他工作 pi-3.

要回复问题请先登录注册