安装redis-py的前提是已经将redis成功安装,redis安装过程请看博文

  ubuntu14安装redis

1.安装pip

sudo apt-get install python-pip

2.使用pip安装redis-py

sudo pip install redis

3.此时便可以在python中使用redis了

 pc@pc-virtual-machine:~/Desktop$ python
Python 2.7.6 (default, Jun 22 2015, 18:00:18)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> r = redis.Redis(host = "localhost")
>>> r.set("name","good night");
True
>>> r.get("name")
'good night'
>>>

4.pip的使用详解

4.1pip安装包

  pip install SomePackage

      [...]

  Successfully installed SomePackage
 
4.2 pip检查哪些包需要升级
  pip list --outdate
 
4.3 pip升级包
  pip install --upgrade SomePackage
 
4.4 pip卸载包
  pip uninstall SomePackage

  Uninstalling SomePackage:
    /my/env/lib/pythonx.x/site-packages/somepackage
  Proceed (y/n)? y
  Successfully uninstalled SomePackage
 
4.5 pip帮助
  

pip --help

Usage:
pip <command> [options]

Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
help Show help for commands.

4.6 ubuntu下会经常使用pip安装一些包,默认使用国外的镜像源,下载比较慢。可以将镜像源设置成国内的。国内有清华、阿里、中科大。

临时使用:
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,这样就会从清华这边的镜像去安装pyspider库。
 
长久使用,修改配置文件
Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

清华大学的pip源,它是官网pypi的镜像,每隔5分钟同步一次

ubuntu中pip安装redis-py及pip的使用的更多相关文章

  1. ubuntu中mysql安装失败

    在ubuntu中mysql安装失败后,卸载重新安装还是安装失败,之后找了资料说是卸载的不干净,然后进行下面操作,重新安装成功. 解决办法如下: sudo rm /var/lib/mysql/ -Rsu ...

  2. ubuntu中python3安装package

    1.实验环境 Ubuntu16.04x86 + python3.5 ubuntu中同时存在python2.7 和 python3.5 2.pip使用说明 sudo pip install packag ...

  3. Ubuntu 12.04 安装Redis并设置主从复制

    今天想在Ubuntu上安装一个Redis服务器并配置Master-Slave,一开始懒得连VPN就查了一些国内的文章,不知道是没有亲自验证过的转载文章,还是版本问题造成的,发现按照步骤都没能成功完成配 ...

  4. Ubuntu 16.04 安装Redis服务器端

    ~ sudo apt-get install redis-server 安装完成后,Redis服务器会自动启动,我们检查Redis服务器程序 检查Redis服务器系统进程 ~ ps -aux|grep ...

  5. Ubuntu中wine安装的程序如何卸载

    很多朋友尝试在Ubuntu中用wine安装exe格式的应用程序,但经常遇到装完之后启动程序就崩溃.或者根本无法启动.无法使用的情况,于是想立即把安装的程序卸载,可是在wine中却找不到卸载exe软件的 ...

  6. Ubuntu中MongoDB安装

    在Ubuntu中MongoDB有时候启动不起来,可以参考以下方法从新安装: 1.导入包管理系统使用的公钥 Ubuntu 的软件包管理工具(即dpkg和APT)要求软件包的发布者通过GPG密钥签名来确保 ...

  7. Linux之Ubuntu中的安装应用

    在Ubuntu中我们经常会使用apt install “APP name” 来安装需要的应用. 从图中我们可以看到,我们使用apt install map命令安装一个map小游戏,这个小游戏是一个用四 ...

  8. Ubuntu 16.04安装Redis

    版本:4.0.2 下载地址:https://redis.io/download 离线版本:(链接: https://pan.baidu.com/s/1bpwDtOr 密码: 4cxk) 安装过程: 源 ...

  9. 1.在ubuntu中软件安装在哪里?

    ubuntu下安装软件有四种方式: 1.通过deb格式的离线软件包安装 sudo dpkg -i xxx.deb # 安装包,安装程序   -i: install sudo dpkg -r packa ...

  10. ubuntu中编译安装gcc 9.2.0

    一切都和其他源码安装软件是一样的: 一.下载源代码: http://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz 二.解压文件 tar xvf gcc- ...

随机推荐

  1. [Backbone]6. Collections.

    Define a collection: var AppointmentList = Backbone.Collection.extend({model: Appointment}); RESET t ...

  2. 7. Add song to Phone

    package com.example.thenewboston; import android.app.Activity; import android.media.MediaPlayer; imp ...

  3. (LeetCode 189)Rotate Array

    Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array ...

  4. DevExpress学习02——DevExpress 14.1的汉化

    汉化资源: 汉化补丁:dxKB_A421_DXperience_v14.1_(2014-06-09):http://www.t00y.com/file/86576990 汉化工具:DXperience ...

  5. Facebook 开源动画库 pop

    官网:https://github.com/facebook/pop Demo: https://github.com/callmeed/pop-playground 一:pop的基本构成: POPP ...

  6. 自定义self.editButtonItem 改变自定义self.editButtonItem的背景图片

    一: // UIButton *editSome; 为全局变量,已开启ARC; editSome = [UIButton buttonWithType:UIButtonTypeCustom]; edi ...

  7. 算法笔记_212:第七届蓝桥杯软件类决赛真题(Java语言B组)

    目录 1 愤怒小鸟 2 反幻方 3 打靶 4 路径之谜 5 碱基 6 圆圈舞 前言:以下代码仅供参考,若有错误欢迎指正哦~ 1 愤怒小鸟 愤怒小鸟 X星球愤怒的小鸟喜欢撞火车! 一根平直的铁轨上两火车 ...

  8. MySQL 联合索引测试2

    接上一篇文章: http://www.cnblogs.com/xiaoit/p/4430300.html 1:首先删掉上一篇建立的索引,重新建立一个. mysql> DROP INDEX idx ...

  9. iOS Dev (50)用代码实现图片加圆角

    用代码实现图片加圆角:       iconView.layer.masksToBounds = YES;       iconView.;

  10. systemctl的常用命令

    #systemctl #systemctl --all #systemctl list-units --type=sokect #systemctl list-units --type=service ...