gpt4 book ai didi

python - redis.exceptions.ConnectionError : Error 97 connecting to localhost:6379. 协议(protocol)不支持的地址族

转载 作者:可可西里 更新时间:2023-11-01 11:31:47 50 4
gpt4 key购买 nike

每当我尝试运行我的程序时,都会出现以下错误。

redis.exceptions.ConnectionError: 错误 97 连接到 localhost:6379。协议(protocol)不支持的地址族。

之前程序运行正常,现在会报这个错。

Traceback (most recent call last):
File "securit.py", line 26, in <module>
bank = red.get('bank')
File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 880, in get
return self.execute_command('GET', name)
File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 578, in execute_command
connection.send_command(*args)
File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 563, in send_command
self.send_packed_command(self.pack_command(*args))
File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 538, in send_packed_command
self.connect()
File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 97 connecting to localhost:6379. Address family not supported by protocol.

最佳答案

最后我得到了上述问题的答案。逐步完成以下操作

 Setup

Before you install redis, there are a couple of prerequisites that need to be downloaded to make the installation as easy as possible.

Start off by updating all of the apt-get packages:

**sudo apt-get update**

Once the process finishes, download a compiler with build essential which will help us install Redis from source:

**sudo apt-get install build-essential**

Finally, we need to download tcl:

**sudo apt-get install tcl8.5**

Installing Redis

With all of the prerequisites and dependencies downloaded to the server, we can go ahead and begin to install redis from source:

Download the latest stable release tarball from Redis.io.

**wget http://download.redis.io/releases/redis-stable.tar.gz**

Untar it and switch into that directory:

**tar xzf redis-stable.tar.gz**

**cd redis-stable**

Proceed to with the make command:

**make**

Run the recommended make test:

**make test**

Finish up by running make install, which installs the program system-wide.

**sudo make install**

Once the program has been installed, Redis comes with a built in script that sets up Redis to run as a background daemon.

To access the script move into the utils directory:

**cd utils**

From there, run the Ubuntu/Debian install script:

**sudo ./install_server.sh**

As the script runs, you can choose the default options by pressing enter. Once the script completes, the redis-server will be running in the background.

关于python - redis.exceptions.ConnectionError : Error 97 connecting to localhost:6379. 协议(protocol)不支持的地址族,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39463403/

50 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com