我正在尝试运行一个示例数据库连接我的mariadb数据库。
python3 sample.py
Traceback (most recent call last):
File "sample.py", line 3, in <module>
import mysql.connector as mariadb
ModuleNotFoundError: No module named 'mysql'我已经安装了python3-mysql.connector。
sudo apt-get -y install python3-mysql.connector
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-mysql.connector is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.发布于 2017-11-26 22:21:13
我建议使用pip来安装Python模块:
sudo pip3 install mysql-connector
然后,您的Python程序应该能够使用该模块。
https://stackoverflow.com/questions/47495708
复制相似问题