Python处理数据库连接:使用pymysql模块
发布时间
阅读量:
阅读量
安装连接SQL的依赖库
常用的数据库连接库包括MySQLdb以及pyMysql
起初尝试使用MySQLdb,但在执行pip install mysqldb命令时出现错误提示,ERROR: Could not find a version that satisfies the requirement mysqldb (from versions: none)
ERROR: No matching distribution found for mysqldb
通过网络搜索发现,可能涉及以下几个因素:
- Python 3.6.1及以上版本不再兼容MySQLdb
- pip工具的版本可能存在不匹配问题
因此最终决定放弃该库,转而采用另一种数据库连接库pymysql
(base) bogon:~ alice$ python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:39:00)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more informat
全部评论 (0)
还没有任何评论哟~
