代码如下:

import redis

r = redis.Redis(host='127.0.0.1', port=6379)
r.set('hello_j', 'hel_2')

print(r.get('hello_j'))

本人机器ubuntu

不过第一次玩转这东西的时候发现 

pycharm导入redis提示No module named redis!

一种是直接安装https://github.com/andymccurdy/redis-py 

不过这种办法 不知道如何配置pycharm


第二种办法上图适合菜鸟:

在pycharm中 依次点击   file-setting-projcet interpreter- 点击右侧的加号,在弹出页面输入redis点击安装即可。

python链接redis

相关文章:

  • 2021-10-08
  • 2022-03-03
  • 2021-05-17
  • 2021-11-28
  • 2021-10-15
  • 2021-07-29
  • 2021-11-11
  • 2021-07-20
猜你喜欢
  • 2022-12-23
  • 2021-05-23
  • 2021-06-10
  • 2021-08-14
  • 2021-09-28
  • 2022-12-23
  • 2021-10-31
相关资源
相似解决方案