ubuntu中pip安装redis-py及pip的使用
安装redis-py的前提是已经将redis成功安装,redis安装过程请看博文
1.安装pip
sudo apt-get install python-pip
2.使用pip安装redis-py
sudo pip install redis
3.此时便可以在python中使用redis了
1 pc@pc-virtual-machine:~/Desktop$ python 2 Python 2.7.6 (default, Jun 22 2015, 18:00:18) 3 [GCC 4.8.2] on linux2 4 Type "help", "copyright", "credits" or "license" for more information. 5 >>> import redis 6 >>> r = redis.Redis(host = "localhost") 7 >>> r.set("name","good night"); 8 True 9 >>> r.get("name") 10 'good night' 11 >>>
4.pip的使用详解
4.1pip安装包
pip install SomePackage
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安装一些包,默认使用国外的镜像源,下载比较慢。可以将镜像源设置成国内的。国内有清华、阿里、中科大。
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple
清华大学的pip源,它是官网pypi的镜像,每隔5分钟同步一次
如果觉得有用,想赞助一下请移步赞助页面:赞助一下
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)