我们如果想要Python 和数据库进行交互的话,必须安装一些Python存储库。
(一)PyMySQL的安装
如果想要Python 和 MySQL 进行数据操作,必须使用PyMySQL库
相关链接:
- GitHub:https://github.com/PyMySQL/PyMySQL
- 官方文档:https://pymysql.readthedocs.io/en/latest/
- PyPI:https://pypi.org/project/PyMySQL/
PiP 安装:
pip3 install pymysql
(二)PyMongo
如果想要Python 对Mongo进行数据操作,必须使用PyMongo库
相关链接:
- GitHub:https://github.com/mongodb/mongo-python-driver
- 官方文档:https://pymongo.readthedocs.io/en/stable/tutorial.html
- PyPI:https://pypi.org/project/pymongo/
pip 安装:
pip3 install pymongo
(三)redis-py的安装
如果想要Python 对redis 进行数据操作,必须使用redis-py库
相关链接:
- GitHub:https://github.com/redis/redis-py
- 官方文档:https://redis-py.readthedocs.io/en/latest/
- PyPI:https://pypi.org/project/redis/
pip 安装
pip3 install reids
RedisDump的安装:
RedisDump 是一个用于 redis 数据导入导出的工具, 是基于 ruby 实现的,所以要安装 RedisDump 必须安装 ruby。
相关链接:
ruby 安装:http://www.ruby-lang.org/zh_cn/documentation/installation/ 进行下载安装即可。
gem 安装:
安装完成之后,就可以执行 gem 命令。 类似于 Python 中的 pip命令,使用 gem 命令来安装 redis-dump
gem install redis-dump
