$ pip install redis
>>> import redis
>>> conn = redis.Redis()
>>> conn.keys('*')
Traceback (most recent call last):
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 484, in connect
sock = self._connect()
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 541, in _connect
raise err
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/henry/.local/lib/python3.5/site-packages/redis/client.py", line 667, in execute_command
connection.send_command(*args)
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 610, in send_command
self.send_packed_command(self.pack_command(*args))
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 585, in send_packed_command
self.connect()
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 489, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 484, in connect
sock = self._connect()
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 541, in _connect
raise err
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/henry/.local/lib/python3.5/site-packages/redis/client.py", line 1032, in keys
return self.execute_command('KEYS', pattern)
File "/home/henry/.local/lib/python3.5/site-packages/redis/client.py", line 673, in execute_command
connection.send_command(*args)
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 610, in send_command
self.send_packed_command(self.pack_command(*args))
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 585, in send_packed_command
self.connect()
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 489, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
上面是错误代码,出现这样的错误,解决方案:

这个问题是因为没安装Redis服务器造成的。

要么是安装一个redis,或者是启动redis。

redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.的更多相关文章

  1. redis.exceptions.ConnectionError: Error 10061 connecting to 127.0.0.1:6379. 由于目标计算机积极拒绝,无法连接

    redis.exceptions.ConnectionError: Error 10061 connecting to 127.0.0.1:6379. 由于目标计算机积极拒绝,无法连接   是由于没有 ...

  2. [Redis-CentOS7]Redis打开远程连接(十) Could not connect to Redis at 127.0.0.1:6379: Connection refused

    通过网络无法访问Redis redis-cli 172.16.1.111 Could not connect to Redis at 127.0.0.1:6379: Connection refuse ...

  3. Redis 服务端配置——Could not connect to Redis at 127.0.0.1:6379: Connection refused

    [root@centoszang 桌面]# redis-cli Could : Connection refused Could : Connection refused not connected& ...

  4. Could not connect to Redis at xxx.xxx.xxx.xxx:6379: Connection refused

    开发发来消息说测试环境的redis无法登录: # redis-cli -p 6379 -h xxx.xxx.xxx.xxx Could not connect to Redis at xxx.xxx. ...

  5. 在 Linux redis 验证交互连接过程中遇到 redis Could not connect to Redis at 127.0.0.1:6379: Connection refused 的解决方法

    Could not connect to Redis at 127.0.0.1:6379: Connection refused 1.找到redis.conf 并修改 daemonize no 为 d ...

  6. redis Could not connect to Redis at 127.0.0.1:6379: Connection refused 问题解决

    1.启动redis 客户端 redis-cli 报错 redis Could not connect to Redis at 127.0.0.1:6379: Connection refused 是因 ...

  7. Could not connect to Redis at 127.0.0.1:6379: Connection refused

    启动redis:  redis-server ../redis.conf redis启动成功后 执行命令行redis-cli报:Could not connect to Redis at 127.0. ...

  8. Redis配置主从时报错“Could not connect to Redis at 192.168.0.50:6379: Connection refused not connected>”

    配置Redis主从时,修改完从节点配置文件,然后报错 [root@Rich七哥-0-50 redis]# /opt/redis/redis-cli -h 192.168.0.50 Could not ...

  9. Could not connect to Redis at 192.168.0.129:6379: Connection refused

    在虚拟机上(CentOS 6.7)本机连接自己的redis [root@localhost bin]# ./redis-cli -h Could not connect to Redis at : C ...

随机推荐

  1. 从手机中提取boot.img

    测试环境:nexus 5,android 6.0 怕出问题可以先用TWRP备份 adb shell su cd /dev/block/platform/msm_sdcc./by-name ls -l ...

  2. linux查看所有用户信息

    所有的用户信息在根目录/etc/中passwd文件内,而passwd的所有权限是root用户及root组用户,所有想要查看所有用户,需要root用户登录系统. root用户登录后,可以直接用查看命令c ...

  3. PHPExcel 读取 xls

    <?php $xlsPath = './test.xls'; //指定要读取的exls路径 //$type = 'Excel2007'; //设置要解析的Excel类型 Excel5(2003或 ...

  4. what's the 黑盒测试

    what's the 黑盒测试 黑盒测试是把测试对象看做一个黑盒子,利用黑盒测试法进行动态测试时,需要测试软件产品已经实现的功能是否符合功能设计要求,不需测试软件产品的内部结构和处理过程. 黑盒测试注 ...

  5. 【LeetCode每天一题】Plus One(加一)

    Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The d ...

  6. List、Set、Map集合

    1 List接口 我们掌握了Collection接口的使用后,再来看看Collection接口中的子类,他们都具备那些特性呢? 接下来,我们一起学习Collection中的常用几个子类(List集合. ...

  7. [macOS] git忽略所有的.DS_Store文件

    最彻底的方法如下: vi ~/.gitignore_global 输入以下内容 # OS generated files # ###################### .DS_Store .DS_ ...

  8. Redis4.0 之持久化存储

    redis如果提供缓存服务,可以关闭所有持久化存储,如此一来redis重启后所有数据会丢失 开启rdb或aof持久化存储,能把redis中的数据持久化到磁盘中. rdb和aof对性能都有影响,所以建议 ...

  9. Promise的那些事儿

    在JavaScript中,异步操作非常多见,然而在Promise之前,我们是在类似以下的做法中处理多重异步回调,每一层里都要调另一个异步函数,形成了所谓的"回调地狱", Promi ...

  10. 寻找U2OS中表达的基因及其promoter并用于后续annotation

    方法1.RNA-seq得到不同表达程度基因 方法2. 直接download U2OS_gene.csv https://cancer.sanger.ac.uk/cell_lines/download ...