zoukankan      html  css  js  c++  java
  • 安装python + redis + pip

    1.安装python3.6

    yum -y install python3.6
    

    2.查看python安装目录下面bin目录中是否已经含有pip

    whereis python
    python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python3.6m /usr/bin/python3.6 /usr/lib/python2.7 /usr/lib/python3.6 /usr/lib64/python2.7 /usr/lib64/python3.6 /etc/python /usr/include/python2.7 /usr/include/python3.6m /usr/share/man/man1/python.1.gz
    

      装的是3.6版本,安装目录自带pip3,并且可以全局使用

    [root@localhost python3.6]# whereis pip3
    pip3: /usr/bin/pip3.6 /usr/bin/pip3
    [root@localhost python3.6]# 
    

    3.安装redis扩展包

    pip3 install redis
    

    4.python连接redis

    [root@localhost ~]# python3
    Python 3.6.8 (default, Apr  2 2020, 13:34:55) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import redis
    >>> conn = redis.Redis(host="127.0.0.1", port=6379, password="")
    >>> conn.set('name', 'itxds')
    True
    >>> conn.get('name')
    b'itxds'
    >>> 
    

      

  • 相关阅读:
    Qt Opencv 在Linux下摄像头简单示例(转)
    自制木头台灯
    css3 transition 动画
    css 旋转动画
    maven 搭建 springmvc + jpa +mysql
    搭建前端框架
    mavean
    Mac上安装 Maven
    Mongdb文档学习笔记
    mongoDB高级查询与索引
  • 原文地址:https://www.cnblogs.com/xiangdongsheng/p/13443579.html
Copyright © 2011-2022 走看看