2016-09-13 75 views
0

当我尝试运行我的程序时,会出现以下错误。redis.exceptions.ConnectionError:错误97连接到本地主机:6379。协议不支持的地址族

redis.exceptions.ConnectionError:错误97连接到本地主机:6379。地址族不受协议支持。

此前程序正常运行,现在会出现此错误。

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. 

回答

0

最后我得到的答案为以上qustion.Step一步下面做

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. 
相关问题